Class MappedDiskSlots
java.lang.Object
com.arjuna.ats.internal.arjuna.objectstore.slot.MappedDiskSlots
- All Implemented Interfaces:
BackingSlots
Memory-mapped file implementation of the SlotStore backend.
WARNING: this is currently a test implementation and is NOT SAFE for production use yet.
- Author:
- Jonathan Halliday (jonathan.halliday@redhat.com), 2020-04
-
Constructor Summary
-
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.
-
Constructor Details
-
MappedDiskSlots
public MappedDiskSlots()
-
-
Method Details
-
init
Description copied from interface:BackingSlots
Initialize the instance from the given configuration. This must be called once per instance, before any other method is called.- Specified by:
init
in interfaceBackingSlots
- Parameters:
config
- The configuration to apply.- Throws:
IOException
-
write
Description copied from interface:BackingSlots
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- Specified by:
write
in interfaceBackingSlots
- Parameters:
slot
- the index, from 0 to config numberOfSlots-1data
- the content.sync
- true for immediate persistence, false otherwise- Throws:
IOException
-
read
Description copied from interface:BackingSlots
Read the given slot, returning its contents.- Specified by:
read
in interfaceBackingSlots
- 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
Description copied from interface:BackingSlots
Update the given slot, discarding the contents. The update may not be immediately persistent, depending on config syncDeletes and isSyncWrites- Specified by:
clear
in interfaceBackingSlots
- Parameters:
slot
- the index, from 0 to config numberOfSlots-1sync
- true for immediate persistence, false otherwise- Throws:
IOException
-