java.lang.Object
com.arjuna.ats.internal.arjuna.objectstore.slot.DiskSlots
All Implemented Interfaces:
BackingSlots

public class DiskSlots extends Object implements BackingSlots
File backed 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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    clear(int slot, boolean sync)
    Update the given slot, discarding the contents.
    void
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DiskSlots

      public DiskSlots()
  • Method Details

    • init

      public void init(SlotStoreEnvironmentBean config) throws IOException
      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 interface BackingSlots
      Parameters:
      config - The configuration to apply.
      Throws:
      IOException
    • write

      public void write(int slot, byte[] data, boolean sync) throws IOException
      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 interface BackingSlots
      Parameters:
      slot - the index, from 0 to config numberOfSlots-1
      data - the content.
      sync - true for immediate persistence, false otherwise
      Throws:
      IOException
    • read

      public byte[] read(int slot) throws IOException
      Description copied from interface: BackingSlots
      Read the given slot, returning its contents.
      Specified by:
      read in interface BackingSlots
      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

      public void clear(int slot, boolean sync) throws IOException
      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 interface BackingSlots
      Parameters:
      slot - the index, from 0 to config numberOfSlots-1
      sync - true for immediate persistence, false otherwise
      Throws:
      IOException