Interface RaftPersistency

Interface used by Raft to persist data and retrieve it if necessary (e.g. after a crash).

Remark

Users can overwrite getRaftPersistencyImplementation to provide their own implementation of this interface if needed.

Hierarchy

  • RaftPersistency

Methods

  • Closes the connection to persistent memory for the Raft node specified by id in the Raft cluster specified by cluster. This function can be used to release potential file locks before this Raft node shuts down. If eraseAllData is set to true, all persisted data is erased from persistent memory before closing the connection.

    Parameters

    • eraseAllData: boolean

      Specifies whether or not to erase all persisted data.

    • id: string

      Specifies the node for which the connection to persistent memory should be closed.

    • cluster: string

      Specifies the cluster of the node for which the connection to persistent memory should be closed.

    Returns Promise<void>

    Promise that is resolved once the data has been erased (if specified) and the connection has been closed. Is rejected if an error occurred while accessing persistent memory.

  • Returns the data that is currently persisted for the given key for the Raft node specified by id in the Raft cluster specified by cluster. That is the data that last was persisted using persistData().

    Parameters

    • key: string

      Specifies the data that will be returned.

    • id: string

      Specifies the node for which data should be returned.

    • cluster: string

      Specifies the cluster of the node for which data should be returned.

    Returns Promise<any>

    Promise containing the currently persisted data for the given key or null if no such data was found. Is rejected if an error occurred while accessing persistent memory.

  • Persists the provided data for the given key for the Raft node specified by id in the Raft cluster specified by cluster. Existing persisted data is overwritten.

    Parameters

    • data: any

      The data that should be persisted. Is of type RaftData.

    • key: string

      Can be used to retrieve the persisted data afterwards.

    • id: string

      Specifies the node for which data should be persisted.

    • cluster: string

      Specifies the cluster of the node for which data should be persisted.

    Returns Promise<void>

    Promise that is resolved after the data was persisted or rejected if an error occurred while accessing persistent memory.

Generated using TypeDoc