/** * A read-only view of a key/value store. It only supports read-only operations. * * <p>The implementation of this class should be thread-safe. */ @Public @Evolving public interface KVStoreReadView<K, V> { /** * Return the value associated with this key. * * @param key key to retrieve the value * @return the value associated with this key. */ V get(K key); /** * Return an {@link KVIterator} to iterate a range of keys. * * @param from the first key * @param to the last key * @return a k/v iterator */ KVIterator<K, V> range(K from, K to); }
/** * Provide a metadata accessor to access customized metadata associated with logs. * * @deprecated this class is here for legacy reason. It is not recommended to use this class for storing customized * metadata. */ @LimitedPrivate @Evolving public interface MetadataAccessor extends Closeable, AsyncCloseable { /** * Get the name of the stream managed by this log manager. * @return streamName */ String getStreamName(); void createOrUpdateMetadata(byte[] metadata) throws IOException; void deleteMetadata() throws IOException; byte[] getMetadata() throws IOException; /** * Close the distributed log metadata, freeing any resources it may hold. */ void close() throws IOException; }
/** * Async Callback for adding entries to ledgers with latency information. * * @since 4.7 */ @InterfaceAudience.Public @InterfaceStability.Evolving interface AddCallbackWithLatency { /** * Callback declaration which additionally passes quorum write complete latency. * * @param rc * return code * @param lh * ledger handle * @param entryId * entry identifier * @param qwcLatency * QuorumWriteComplete Latency * @param ctx * context object */ void addCompleteWithLatency(int rc, LedgerHandle lh, long entryId, long qwcLatency, Object ctx); }
@Evolving public interface OpFactory<K, V> {
/** * A compare operator used in a {@link org.apache.bookkeeper.api.kv.Txn}. * * @param <K> key type * @param <V> value type */ @Public @Evolving public interface CompareOp<K, V> extends AutoCloseable { CompareTarget target(); CompareResult result(); K key(); V value(); long revision(); @Override void close(); }
/** * A mvcc store that supports synchronous operations. * * @param <K> key type * @param <V> value type */ @Public @Evolving public interface MVCCStore<K, V> extends StateStore, MVCCStoreWriteView<K, V>, MVCCStoreReadView<K, V> { /** * Return the operator factory to build operators. * * @return operator factory. */ OpFactory<K, V> getOpFactory(); }
/** * Iterator to iterate key/value pairs of the read-view of a k/v store. */ @Public @Evolving public interface KVIterator<K, V> extends Iterator<KV<K, V>>, AutoCloseable { /** * Close the iterator to release resources held by this iterator. * * <p>The users of this interface should be responsible for closing the iterator. */ @Override void close(); }
/** * The read view for a {@link MVCCAsyncStore}. * * @param <K> key type * @param <V> value type */ @Public @Evolving public interface MVCCAsyncStoreReadView<K, V> { CompletableFuture<V> get(K key); CompletableFuture<KeyValue<K, V>> getKeyValue(K key); CompletableFuture<List<KeyValue<K, V>>> range(K key, K endKey); CompletableFuture<RangeResult<K, V>> range(RangeOp<K, V> rangeOp); }
/** * A put operator that update a value associated with a given key. * * @param <K> key type * @param <V> value type */ @Public @Evolving public interface PutOp<K, V> extends Op<K, V> { K key(); V value(); PutOption<K> option(); }
/** * A put operator that update a value associated with a given key. * * @param <K> key type * @param <V> value type */ @Public @Evolving public interface IncrementOp<K, V> extends Op<K, V> { K key(); long amount(); IncrementOption<K> option(); }
/** * The read view for a mvcc store. * * @param <K> key type. * @param <V> value type. */ @Public @Evolving public interface MVCCStoreReadView<K, V> { RangeResult<K, V> range(RangeOp<K, V> rangeOp); }
/** * A key/value state store that supports put/get/delete/range operations. */ @Public @Evolving public interface KVStore<K, V> extends StateStore, KVStoreWriteView<K, V>, KVStoreReadView<K, V> { }
/** * A range operation. */ @Public @Evolving public interface RangeOp<K, V> extends Op<K, V> { K key(); RangeOption<K> option(); }
/** * A class represents a key value pair. * * @param <K> key type * @param <V> value type */ @Public @Evolving public interface KV<K, V> { K key(); V value(); }
/** * Interface of kv client talking to partitioned table. */ @InterfaceAudience.Public @InterfaceStability.Evolving public interface PTable<K, V> extends PTableReadView<K, V>, PTableWriteView<K, V> { }
/** * Position in a stream. */ @Public @Evolving public interface Position { }
/** * Abstract Operation. */ @Public @Evolving public interface Op<K, V> extends AutoCloseable { OpType type(); @Override void close(); }
/** * Listener for the the available bookies changes. */ @InterfaceAudience.Private @InterfaceStability.Evolving public interface BookiesListener { /** * Callback method triggered when the list of available bookies are changed. */ void availableBookiesChanged(); }
/** * Interface of kv client talking to partitioned table. */ @InterfaceAudience.Public @InterfaceStability.Evolving public interface Table<K, V> extends TableReadView<K, V>, TableWriteView<K, V> { }
@Evolving public interface LedgerOffloaderFactory<T extends LedgerOffloader> {