Interface Persister

All Known Implementing Classes:
AbstractPersister, FilePersister, MemoryPersister, RocksPersister

public interface Persister

Implementations of this interface save and restore a serialized form of an Actor. One Persister per Actor. However, persisters are free to consolidate resource usage but must be aware that doing so can encounter concurrency issues.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The framework calls the begin method when it is about to execute what might turn out to be a series of calls to this persister that should be considered as a single transaction.
    void
    This method is called when the framework has concluded a series of writes that could be rolled back in case of an error.
    byte[]
    read(String fieldName)
    This method is called by the framework when an actor's processMessage method is about to be called for the first time after the Actor has been instantiated.
    void
    When a series of writes should be rolled back: not written in the first place, replaced with a previous version, etc.
    void
    write(String fieldName, byte[] bytes)
    The save method is called by the framework when an actor's state has been updated.
  • Method Details

    • begin

      void begin()
      The framework calls the begin method when it is about to execute what might turn out to be a series of calls to this persister that should be considered as a single transaction.
    • commit

      void commit()
      This method is called when the framework has concluded a series of writes that could be rolled back in case of an error.
    • rollback

      void rollback()
      When a series of writes should be rolled back: not written in the first place, replaced with a previous version, etc.
    • write

      void write(String fieldName, byte[] bytes)
      The save method is called by the framework when an actor's state has been updated. The key provided is unique id within an actor instance. The key can be anything but by convention it is either "actor" meaning all of the scalar attributes of the actor with @Save annotation. For collections, the key is a combination of the @Save name, a dollar sign, and the key used in a map collection. For a set, the key is the unique id of the set entry, the same as used in the equals method for the set. The ActorId was provided during construction of this persister.
      Parameters:
      fieldName -
      bytes -
    • read

      byte[] read(String fieldName)
      This method is called by the framework when an actor's processMessage method is about to be called for the first time after the Actor has been instantiated.
      Parameters:
      fieldName -