Class BKStateStoreImpl

java.lang.Object
org.apache.pulsar.functions.instance.state.BKStateStoreImpl
All Implemented Interfaces:
AutoCloseable, org.apache.pulsar.functions.api.state.ByteBufferStateStore, org.apache.pulsar.functions.api.state.CounterStateStore, org.apache.pulsar.functions.api.StateStore, DefaultStateStore

public class BKStateStoreImpl extends Object implements DefaultStateStore
This class accumulates the state updates from one function.

currently it exposes incr operations. but we can expose other key/values operations if needed.

  • Constructor Details

    • BKStateStoreImpl

      public BKStateStoreImpl(String tenant, String namespace, String name, org.apache.bookkeeper.api.kv.Table<io.netty.buffer.ByteBuf,io.netty.buffer.ByteBuf> table)
  • Method Details

    • tenant

      public String tenant()
      Specified by:
      tenant in interface org.apache.pulsar.functions.api.StateStore
    • namespace

      public String namespace()
      Specified by:
      namespace in interface org.apache.pulsar.functions.api.StateStore
    • name

      public String name()
      Specified by:
      name in interface org.apache.pulsar.functions.api.StateStore
    • fqsn

      public String fqsn()
      Specified by:
      fqsn in interface org.apache.pulsar.functions.api.StateStore
    • init

      public void init(org.apache.pulsar.functions.api.StateStoreContext ctx)
      Specified by:
      init in interface org.apache.pulsar.functions.api.StateStore
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.apache.pulsar.functions.api.StateStore
    • incrCounterAsync

      public CompletableFuture<Void> incrCounterAsync(String key, long amount)
      Specified by:
      incrCounterAsync in interface org.apache.pulsar.functions.api.state.CounterStateStore
    • incrCounter

      public void incrCounter(String key, long amount)
      Specified by:
      incrCounter in interface org.apache.pulsar.functions.api.state.CounterStateStore
    • getCounterAsync

      public CompletableFuture<Long> getCounterAsync(String key)
      Specified by:
      getCounterAsync in interface org.apache.pulsar.functions.api.state.CounterStateStore
    • getCounter

      public long getCounter(String key)
      Specified by:
      getCounter in interface org.apache.pulsar.functions.api.state.CounterStateStore
    • putAsync

      public CompletableFuture<Void> putAsync(String key, ByteBuffer value)
      Specified by:
      putAsync in interface org.apache.pulsar.functions.api.state.ByteBufferStateStore
    • put

      public void put(String key, ByteBuffer value)
      Specified by:
      put in interface org.apache.pulsar.functions.api.state.ByteBufferStateStore
    • deleteAsync

      public CompletableFuture<Void> deleteAsync(String key)
      Specified by:
      deleteAsync in interface org.apache.pulsar.functions.api.state.ByteBufferStateStore
    • delete

      public void delete(String key)
      Specified by:
      delete in interface org.apache.pulsar.functions.api.state.ByteBufferStateStore
    • getAsync

      public CompletableFuture<ByteBuffer> getAsync(String key)
      Specified by:
      getAsync in interface org.apache.pulsar.functions.api.state.ByteBufferStateStore
    • get

      public ByteBuffer get(String key)
      Specified by:
      get in interface org.apache.pulsar.functions.api.state.ByteBufferStateStore