Class SlotStore
java.lang.Object
com.arjuna.ats.internal.arjuna.objectstore.slot.SlotStore
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 Summary
FieldsModifier and TypeFieldDescriptionfinal ConcurrentHashMap
<SlotStoreKey, Integer> final BackingSlots
-
Constructor Summary
ConstructorsConstructorDescriptionSlotStore
(SlotStoreEnvironmentBean config) Create a new instance with the given configuration. -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(SlotStoreKey key) Determines if a given entry is present in the store.String[]
Return a list of all the distinct type names for records in the storegetMatchingKeys
(SlotStoreKey templateKey) Return all keys in the store having the same typename and (matching or unknown) state as the provided key.read
(SlotStoreKey key) Retrieve the serialized state for an entry.boolean
remove
(SlotStoreKey key) Remove the state for an entry, freeing the slot.boolean
write
(SlotStoreKey key, OutputObjectState outputObjectState) Write (or overwrite) an entry with the given key and value.
-
Field Details
-
slotIdIndex
-
freeList
-
slots
-
-
Constructor Details
-
SlotStore
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
- Returns:
- the "name" of the object store. Where in the hierarchy it appears, e.g., /ObjectStore/MyName/...
-
read
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
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
Write (or overwrite) an entry with the given key and value.- Parameters:
key
- The unique identifier for the entryoutputObjectState
- The serialized state- Returns:
- true on success, false otherwise e.g. when the store is full.
- Throws:
IOException
- if serialization fails
-
contains
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
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
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.
-