java.lang.Object
com.arjuna.ats.internal.arjuna.objectstore.slot.SlotStore

public class SlotStore extends Object
A storage system presenting a key-value API, implemented (conceptually) using a fixed sized array.
Author:
Jonathan Halliday (jonathan.halliday@redhat.com), 2020-03
  • Field Details

  • Constructor Details

    • SlotStore

      public SlotStore(SlotStoreEnvironmentBean config) throws IOException
      Create a new instance with the given configuration.
      Parameters:
      config - The configuration parameters for the instance
      Throws:
      IOException - if the required backing storage can't be initialized.
  • Method Details

    • getStoreName

      public String getStoreName()
      Returns:
      the "name" of the object store. Where in the hierarchy it appears, e.g., /ObjectStore/MyName/...
    • read

      public InputObjectState read(SlotStoreKey key) throws IOException
      Retrieve the serialized state for an entry.
      Parameters:
      key - The unique identifier for the entry
      Returns:
      The serialized state
      Throws:
      IOException - if the entry is not found
    • remove

      public boolean remove(SlotStoreKey key) throws IOException
      Remove the state for an entry, freeing the slot. Depending on the configuration, this change may not be immediately persistent.
      Parameters:
      key - The unique identifier for the entry
      Returns:
      true on success, false otherwise
      Throws:
      IOException - unused for now in this impl.
    • write

      public boolean write(SlotStoreKey key, OutputObjectState outputObjectState) throws IOException
      Write (or overwrite) an entry with the given key and value.
      Parameters:
      key - The unique identifier for the entry
      outputObjectState - The serialized state
      Returns:
      true on success, false otherwise e.g. when the store is full.
      Throws:
      IOException - if serialization fails
    • contains

      public boolean contains(SlotStoreKey key)
      Determines if a given entry is present in the store.
      Parameters:
      key - The unique identifier for the entry
      Returns:
      true if found, false otherwise
    • getKnownTypes

      public String[] getKnownTypes()
      Return a list of all the distinct type names for records in the store
      Returns:
      a list, possibly empty but not null, of distinct types names.
    • getMatchingKeys

      public SlotStoreKey[] getMatchingKeys(SlotStoreKey templateKey)
      Return all keys in the store having the same typename and (matching or unknown) state as the provided key.
      Parameters:
      templateKey - a template key to match in the search. Uid part is ignored, typename and state are used in matching
      Returns:
      an array, possible empty but non-null, of matching keys.