Interface LocalBucket

All Superinterfaces:
Bucket
All Known Implementing Classes:
LockFreeBucket, SynchronizedBucket, ThreadUnsafeBucket

public interface LocalBucket extends Bucket
Represents the bucket inside current JVM.
  • Method Details

    • getConfiguration

      BucketConfiguration getConfiguration()
      Returns configuration of this bucket.
      Returns:
      configuration
    • getTimeMeter

      TimeMeter getTimeMeter()
      Returns the clock that is used by this bucket
      Returns:
      the clock that is used by this bucket
    • getSynchronizationStrategy

      SynchronizationStrategy getSynchronizationStrategy()
      Returns the synchronization strategy that is used by this bucket
      Returns:
      synchronization strategy that is used by this bucket
    • toBinarySnapshot

      default byte[] toBinarySnapshot() throws IOException
      Takes the binary snapshot of this bucket that later can be used as parameter for fromBinarySnapshot(byte[]) to restore bucket from snapshot.
      Returns:
      the binary snapshot of this bucket
      Throws:
      IOException
    • fromBinarySnapshot

      static LocalBucket fromBinarySnapshot(byte[] snapshot) throws IOException
      Reconstructs a bucket from binary snapshot.
      Parameters:
      snapshot - binary snapshot
      Returns:
      bucket reconstructed from binary snapshot
      Throws:
      IOException
    • toJsonCompatibleSnapshot

      default Map<String,Object> toJsonCompatibleSnapshot() throws IOException
      Takes the JSON snapshot of this bucket that later can be used as parameter for fromJsonCompatibleSnapshot(Map) to restore bucket from snapshot.
      Returns:
      the map that transparently can be serialized to JSON via any JSON library
      Throws:
      IOException
    • fromJsonCompatibleSnapshot

      static LocalBucket fromJsonCompatibleSnapshot(Map<String,Object> snapshot) throws IOException
      Reconstructs a bucket from JSON snapshot.
      Parameters:
      snapshot - the snapshot Map that was deserialized from JSON via any JSON library
      Returns:
      bucket reconstructed from binary snapshot
      Throws:
      IOException