Interface PrimitiveService

All Known Implementing Classes:
AbstractPrimitiveService

public interface PrimitiveService
Base class for user-provided services.
See Also:
Commit, ServiceContext, ServiceExecutor
  • Method Summary

    Modifier and Type Method Description
    byte[] apply​(Commit<byte[]> commit)
    Applies a commit to the state machine.
    void backup​(BackupOutput output)
    Backs up the service state to the given buffer.
    default void close()
    Closes the state machine.
    void close​(SessionId sessionId)
    Closes the session with the given identifier.
    void expire​(SessionId sessionId)
    Expires the session with the given identifier.
    void init​(ServiceContext context)
    Initializes the state machine.
    void register​(Session session)
    Registers a primitive session.
    void restore​(BackupInput input)
    Restores the service state from the given buffer.
    io.atomix.utils.serializer.Serializer serializer()
    Returns the primitive service serializer.
    void tick​(io.atomix.utils.time.WallClockTimestamp timestamp)
    Increments the Raft service time to the given timestamp.
  • Method Details

    • init

      void init​(ServiceContext context)
      Initializes the state machine.
      Parameters:
      context - The state machine context.
      Throws:
      NullPointerException - if context is null
    • tick

      void tick​(io.atomix.utils.time.WallClockTimestamp timestamp)
      Increments the Raft service time to the given timestamp.
      Parameters:
      timestamp - the service timestamp
    • serializer

      io.atomix.utils.serializer.Serializer serializer()
      Returns the primitive service serializer.
      Returns:
      the primitive service serializer
    • backup

      void backup​(BackupOutput output)
      Backs up the service state to the given buffer.
      Parameters:
      output - the buffer to which to back up the service state
    • restore

      void restore​(BackupInput input)
      Restores the service state from the given buffer.
      Parameters:
      input - the buffer from which to restore the service state
    • apply

      byte[] apply​(Commit<byte[]> commit)
      Applies a commit to the state machine.
      Parameters:
      commit - the commit to apply
      Returns:
      the commit result
    • register

      void register​(Session session)
      Registers a primitive session.
      Parameters:
      session - the session to register
    • expire

      void expire​(SessionId sessionId)
      Expires the session with the given identifier.
      Parameters:
      sessionId - the session identifier
    • close

      void close​(SessionId sessionId)
      Closes the session with the given identifier.
      Parameters:
      sessionId - the session identifier
    • close

      default void close()
      Closes the state machine.