kurrentdb/operation/tombstone_stream

Build and decode tombstone stream requests.

Tombstoning permanently deletes a stream. A tombstoned stream cannot be recreated, and later operations against the stream will report that it was deleted. This module is sans-IO: it builds Streams/Tombstone requests and decodes the responses returned by a transport backend.

Types

Configuration for a tombstone operation.

pub opaque type Configuration

Expected stream revision used for optimistic concurrency checks.

pub type ExpectedRevision {
  Revision(Int)
  NoStream
  Any
  StreamExists
}

Constructors

  • Revision(Int)
  • NoStream
  • Any
  • StreamExists

Transaction log position returned by KurrentDB for a tombstone.

pub type Position {
  NoPositionReturned
  Position(commit_position: Int, prepare_position: Int)
}

Constructors

  • NoPositionReturned
  • Position(commit_position: Int, prepare_position: Int)

Errors that can occur while decoding a tombstone response.

pub type ResponseError {
  GrpcError(kurrentdb.GrpcError)
  EmptyResponse
  ManyResponses
  HttpStatus(Int)
  IncompleteHeader
  CompressedMessage
  IncompleteMessage(expected_bytes: Int)
}

Constructors

  • GrpcError(kurrentdb.GrpcError)
  • EmptyResponse
  • ManyResponses
  • HttpStatus(Int)
  • IncompleteHeader
  • CompressedMessage
  • IncompleteMessage(expected_bytes: Int)

Successful tombstone result.

pub type Tombstone {
  Tombstone(position: Position)
}

Constructors

Values

pub fn configure() -> Configuration

Create tombstone configuration with the default expected revision.

The default is Any, meaning KurrentDB will accept the tombstone regardless of the stream’s current revision.

pub fn expected_revision(
  config: Configuration,
  expected_revision: Int,
) -> Configuration

Set the expected stream revision for optimistic concurrency.

pub fn request(
  client: kurrentdb.Client,
  stream stream_name: String,
  config config: Configuration,
) -> request.Request(BitArray)

Build a Streams/Tombstone gRPC request.

The returned request is ready for a backend to send over HTTP/2.

pub fn response(
  response: response.Response(BitArray),
) -> Result(Tombstone, ResponseError)

Decode a tombstone response from a backend HTTP response.

A successful response contains the transaction log position when the server includes it.

Search Document