Interface BackingSlots
- All Known Implementing Classes:
DiskSlots
,MappedDiskSlots
,PmemSlots
,VolatileSlots
public interface BackingSlots
Interface for pluggable internal implementations of the SlotStore backend.
- Author:
- Jonathan Halliday (jonathan.halliday@redhat.com), 2020-04
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear
(int slot, boolean sync) Update the given slot, discarding the contents.void
init
(SlotStoreEnvironmentBean config) Initialize the instance from the given configuration.byte[]
read
(int slot) Read the given slot, returning its contents.void
write
(int slot, byte[] data, boolean sync) Update the given slot with the provided data, overwriting (non-atomically) any existing data.
-
Method Details
-
init
Initialize the instance from the given configuration. This must be called once per instance, before any other method is called.- Parameters:
config
- The configuration to apply.- Throws:
IOException
-
write
Update the given slot with the provided data, overwriting (non-atomically) any existing data. The update may not be immediately persistent, depending on config syncWrites- Parameters:
slot
- the index, from 0 to config numberOfSlots-1sync
- true for immediate persistence, false otherwisedata
- the content.- Throws:
IOException
-
read
Read the given slot, returning its contents.- Parameters:
slot
- the index, from 0 to config numberOfSlots-1- Returns:
- the content, or null if the slot has not been written or has been cleared.
- Throws:
IOException
-
clear
Update the given slot, discarding the contents. The update may not be immediately persistent, depending on config syncDeletes and isSyncWrites- Parameters:
slot
- the index, from 0 to config numberOfSlots-1sync
- true for immediate persistence, false otherwise- Throws:
IOException
-