Class Container

java.lang.Object
org.rostore.v2.container.Container
All Implemented Interfaces:
AutoCloseable, Closeable

public class Container extends Object implements Closeable
Container class to manage access to the set of keys and their values.

This class combines several shards.

  • Constructor Details

    • Container

      protected Container(ContainerListOperations containerListOperations, String name, ContainerDescriptor descriptor)
      This one opens up the container if it has already been created.
      Parameters:
      containerListOperations - the over-class that manges the container list
      name - the name of the container
      descriptor - the container metadata
    • Container

      protected Container(ContainerListOperations containerListOperations, String name, ContainerMeta containerMeta)
      This constructor creates a new container.

      This function creates the ContainerDescriptor that should be stored on the container list as a value and opened again on the container-open operation

      Parameters:
      containerListOperations - the over-class that manges the container list
      name - the name of the container
      containerMeta - the metadata of the container
  • Method Details

    • getBlockAllocation

      public BlockAllocationState getBlockAllocation()
    • getName

      public String getName()
      The name of the container.
      Returns:
      the name of the container
    • getDescriptor

      public ContainerDescriptor getDescriptor()
      The container descriptor defines the persistence model of the container.
      Returns:
      the container descriptor.
    • getContainerListOperations

      public ContainerListOperations getContainerListOperations()
      This is the major (parent) class that manages the list of containers
      Returns:
      the over-class
    • checkFreeSpaceToCreateContainer

      public static final void checkFreeSpaceToCreateContainer(String name, Media media, ContainerMeta containerMeta)
    • remove

      protected void remove()
    • getShard

      public ContainerShard getShard(int shardIndex)
      Requests the shard by index.
      Parameters:
      shardIndex - the shard's index
      Returns:
      the container's shard
    • closeInternal

      protected void closeInternal()
      Use close() to close the containers.
    • close

      public void close()
      Closes the container and removes any references of it from the ContainerListOperations
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getStatus

      public Status getStatus()
      Description copied from interface: Closeable
      Provides a status of this entity
      Specified by:
      getStatus in interface Closeable
      Returns:
      the status