All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jsimpledb.kv.util.ForwardingKVStore Maven / Gradle / Ivy

The newest version!

/*
 * Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
 */

package org.jsimpledb.kv.util;

import org.jsimpledb.kv.KVPair;
import org.jsimpledb.kv.KVStore;
import org.jsimpledb.util.CloseableIterator;

/**
 * Forwards all {@link KVStore} operations to another underlying {@link KVStore}.
 */
public abstract class ForwardingKVStore implements KVStore {

    /**
     * Get the underlying {@link KVStore}.
     *
     * @return underlying {@link KVStore}
     */
    protected abstract KVStore delegate();

// KVStore

    @Override
    public byte[] get(byte[] key) {
        return this.delegate().get(key);
    }

    @Override
    public KVPair getAtLeast(byte[] minKey, byte[] maxKey) {
        return this.delegate().getAtLeast(minKey, maxKey);
    }

    @Override
    public KVPair getAtMost(byte[] maxKey, byte[] minKey) {
        return this.delegate().getAtMost(maxKey, minKey);
    }

    @Override
    public CloseableIterator getRange(byte[] minKey, byte[] maxKey, boolean reverse) {
        return this.delegate().getRange(minKey, maxKey, reverse);
    }

    @Override
    public void put(byte[] key, byte[] value) {
        this.delegate().put(key, value);
    }

    @Override
    public void remove(byte[] key) {
        this.delegate().remove(key);
    }

    @Override
    public void removeRange(byte[] minKey, byte[] maxKey) {
        this.delegate().removeRange(minKey, maxKey);
    }

    @Override
    public void adjustCounter(byte[] key, long amount) {
        this.delegate().adjustCounter(key, amount);
    }

    @Override
    public byte[] encodeCounter(long value) {
        return this.delegate().encodeCounter(value);
    }

    @Override
    public long decodeCounter(byte[] bytes) {
        return this.delegate().decodeCounter(bytes);
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy