Source repository for the S2 gRPC API is github.com/s2-streamstore/s2-protos

Alternative to this reference: Buf documentation.

AccountService

Operate on an S2 account.

Method NameRequest TypeResponse TypeDescriptionOptions
ListBasinsListBasinsRequestListBasinsResponseList basins.
  • idempotency_level: NO_SIDE_EFFECTS
CreateBasinCreateBasinRequestCreateBasinResponseCreate a new basin. Provide a client request token with the S2-Request-Token header for idempotent retry behaviour.
  • idempotency_level: IDEMPOTENT
DeleteBasinDeleteBasinRequestDeleteBasinResponseDelete a basin. Basin deletion is asynchronous, and may take a few minutes to complete.
  • idempotency_level: IDEMPOTENT
ReconfigureBasinReconfigureBasinRequestReconfigureBasinResponseUpdate basin configuration.
  • idempotency_level: IDEMPOTENT
GetBasinConfigGetBasinConfigRequestGetBasinConfigResponseGet basin configuration.
  • idempotency_level: NO_SIDE_EFFECTS

BasinService

Operate on an S2 basin.

Method NameRequest TypeResponse TypeDescriptionOptions
ListStreamsListStreamsRequestListStreamsResponseList streams.
  • idempotency_level: NO_SIDE_EFFECTS
CreateStreamCreateStreamRequestCreateStreamResponseCreate a stream. Provide a client request token with the S2-Request-Token header for idempotent retry behaviour.
  • idempotency_level: IDEMPOTENT
DeleteStreamDeleteStreamRequestDeleteStreamResponseDelete a stream. Stream deletion is asynchronous, and may take a few minutes to complete.
  • idempotency_level: IDEMPOTENT
GetStreamConfigGetStreamConfigRequestGetStreamConfigResponseGet stream configuration.
  • idempotency_level: NO_SIDE_EFFECTS
ReconfigureStreamReconfigureStreamRequestReconfigureStreamResponseUpdate stream configuration.
  • idempotency_level: IDEMPOTENT

StreamService

Operate on an S2 stream.

Method NameRequest TypeResponse TypeDescriptionOptions
CheckTailCheckTailRequestCheckTailResponseCheck the sequence number that will be assigned to the next record on a stream.
  • idempotency_level: NO_SIDE_EFFECTS
AppendAppendRequestAppendResponseAppend a batch of records to a stream.None
AppendSessionAppendSessionRequest streamAppendSessionResponse streamAppend batches of records to a stream continuously, while guaranteeing pipelined requests are processed in order. If any request fails, the session is terminated.None
ReadReadRequestReadResponseRetrieve a batch of records from a stream.
  • idempotency_level: NO_SIDE_EFFECTS
ReadSessionReadSessionRequestReadSessionResponse streamRetrieve batches of records from a stream continuously.
  • idempotency_level: NO_SIDE_EFFECTS

AppendInput

Input for append requests.

FieldTypeLabelDescription
streamstringStream name. Optional for subsequent requests in the session.
recordsAppendRecordrepeatedBatch of records to append atomically, which must contain at least one record, and no more than 1000. The total size of a batch of records may not exceed 1MiB of metered bytes.
match_seq_numuint64optionalEnforce that the sequence number issued to the first record matches.
fencing_tokenbytesoptionalEnforce a fencing token which must have been previously set by a fence command record.

AppendOutput

Output from append response.

FieldTypeLabelDescription
start_seq_numuint64Sequence number of first record appended.
end_seq_numuint64Sequence number of last record appended + 1. end_seq_num - start_seq_num will be the number of records in the batch.
next_seq_numuint64Sequence number of last durable record on the stream + 1. This can be greater than end_seq_num in case of concurrent appends.

AppendRecord

Record to be appended to a stream.

FieldTypeLabelDescription
headersHeaderrepeatedSeries of name-value pairs for this record.
bodybytesBody of this record.

AppendRequest

Append request.

FieldTypeLabelDescription
inputAppendInputRequest parameters for an append.

AppendResponse

Append response.

FieldTypeLabelDescription
outputAppendOutputResponse details for an append.

AppendSessionRequest

Append session request.

FieldTypeLabelDescription
inputAppendInputRequest parameters for an append.

AppendSessionResponse

Append session response.

FieldTypeLabelDescription
outputAppendOutputResponse details for an append.

BasinConfig

Basin configuration.

FieldTypeLabelDescription
default_stream_configStreamConfigDefault stream configuration.

BasinInfo

Basin information.

FieldTypeLabelDescription
namestringBasin name.
scopestringBasin scope.
cellstringCell assignment.
stateBasinStateBasin state.

CheckTailRequest

Check tail request.

FieldTypeLabelDescription
streamstringStream name.

CheckTailResponse

Check tail response.

FieldTypeLabelDescription
next_seq_numuint64Sequence number that will be assigned to the next record on the stream.

CreateBasinRequest

Create basin request.

FieldTypeLabelDescription
basinstringBasin name, which must be globally unique. It can be omitted to let the service assign a unique name. The name must be between 8 and 48 characters, comprising lowercase letters, numbers and hyphens. It cannot begin or end with a hyphen.
configBasinConfigBasin configuration.
scopestringBasin scope. It should be formatted as ”:”, e.g. “aws:us-east-1”.
cellstringExplicit cell assignment, if it is owned by the account.

CreateBasinResponse

Create basin response.

FieldTypeLabelDescription
infoBasinInfoInformation about the newly created basin.

CreateStreamRequest

Create stream request.

FieldTypeLabelDescription
streamstringStream name, which must be unique within the basin. It can be an arbitrary string upto 512 characters. Backslash (/) is recommended as a delimiter for hierarchical naming.
configStreamConfigConfiguration for the new stream.

CreateStreamResponse

Create stream response.

FieldTypeLabelDescription
infoStreamInfoInformation about the newly created stream.

DeleteBasinRequest

Delete basin request.

FieldTypeLabelDescription
basinstringName of the basin to delete.

DeleteBasinResponse

Delete basin response.

DeleteStreamRequest

Delete stream request.

FieldTypeLabelDescription
streamstringStream name.

DeleteStreamResponse

Delete stream response.

GetBasinConfigRequest

Get basin configuration request.

FieldTypeLabelDescription
basinstringBasin name.

GetBasinConfigResponse

Get basin configuration response.

FieldTypeLabelDescription
configBasinConfigBasin configuration.

GetStreamConfigRequest

Get stream configuration request.

FieldTypeLabelDescription
streamstringStream name.

GetStreamConfigResponse

Get stream configuration response.

FieldTypeLabelDescription
configStreamConfigStream configuration.

Headers add structured information to a record as name-value pairs.

Header names cannot be empty, with the exception of “command messages” that are interpreted by S2. A command message is signalled by a sole header with empty name. The header value represents an operation, and the record body acts as a payload for the command. S2 client SDKs provide high-level APIs for command messages, and advanced users may also create them directly.

Valid operations are as follows:

  • fence with an upto 16 byte payload to set a fencing token. An empty payload clears the token. Fencing is strongly consistent, and subsequent appends that specify a fencing token will be rejected if it does not match.
  • trim with exactly 8 big-endian bytes as payload representing the desired earliest sequence number. This sequence number is only allowed to advance, and any regression will be ignored. Trimming is eventually consistent, and trimmed records may be visible for a brief period.
FieldTypeLabelDescription
namebytesHeader name blob.
valuebytesHeader value blob.

ListBasinsRequest

List basins request.

FieldTypeLabelDescription
prefixstringList basin names that begin with this prefix.
start_afterstringOnly return basins names that lexicographically start after this name. This can be the last basin name seen in a previous listing, to continue from there. It must be greater than or equal to the prefix if specified.
limituint64Number of results, upto a maximum of 1000.

ListBasinsResponse

List basins response.

FieldTypeLabelDescription
basinsBasinInforepeatedMatching basins.
has_moreboolIf set, indicates there are more results that can be listed with start_after.

ListStreamsRequest

List streams request.

FieldTypeLabelDescription
prefixstringList stream names that begin with this prefix.
start_afterstringOnly return stream names that lexicographically start after this name. This can be the last stream name seen in a previous listing, to continue from there. It must be greater than or equal to the prefix if specified.
limituint64Number of results, upto a maximum of 1000.

ListStreamsResponse

List streams response.

FieldTypeLabelDescription
streamsStreamInforepeatedMatching streams.
has_moreboolIf set, indicates there are more results that can be listed with start_after.

ReadLimit

If both count and bytes are non-zero, either limit may be hit.

FieldTypeLabelDescription
countuint64A value of zero signifies no count limit.
bytesuint64A value of zero signifies no bytes limit. Record sizes are calculated as metered bytes.

ReadOutput

Output from read response.

FieldTypeLabelDescription
batchSequencedRecordBatchBatch of records. This batch can be empty only if a ReadLimit was provided in the associated read request, but the first record that could have been returned would violate the limit.
first_seq_numuint64Sequence number for the first record on this stream, in case the requested start_seq_num is smaller. If returned in a streaming read session, this will be a terminal reply, to signal that there is uncertainty about whether some records may be omitted. The client can re-establish the session starting at this sequence number.
next_seq_numuint64Sequence number for the next record on this stream, in case the requested start_seq_num was larger. If returned in a streaming read session, this will be a terminal reply.

ReadRequest

Read request.

FieldTypeLabelDescription
streamstringStream name.
start_seq_numuint64Starting sequence number (inclusive).
limitReadLimitoptionalLimit on how many records can be returned upto a maximum of 1000, or 1MiB of metered bytes.

ReadResponse

Read response.

FieldTypeLabelDescription
outputReadOutputResponse details for a read.

ReadSessionRequest

Read session request.

FieldTypeLabelDescription
streamstringStream name.
start_seq_numuint64Starting sequence number (inclusive).
limitReadLimitoptionalLimit on how many records can be returned. When a limit is specified, the session will be terminated as soon as the limit is met, or when the current tail of the stream is reached — whichever occurs first. If no limit is specified, the session will remain open after catching up to the tail, and continue tailing as new messages are written to the stream.

ReadSessionResponse

Read session response.

FieldTypeLabelDescription
outputReadOutputResponse details for a read.

ReconfigureBasinRequest

Reconfigure basin request.

FieldTypeLabelDescription
basinstringBasin name.
configBasinConfigBasin configuration.
maskgoogle.protobuf.FieldMaskSpecifies the pieces of configuration being updated. See https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask

ReconfigureBasinResponse

Reconfigure basin response.

FieldTypeLabelDescription
configBasinConfigBasin configuration.

ReconfigureStreamRequest

Reconfigure stream request.

FieldTypeLabelDescription
streamstringStream name.
configStreamConfigStream configuration with updated values.
maskgoogle.protobuf.FieldMaskSpecifies the pieces of configuration being updated. See https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask

ReconfigureStreamResponse

Reconfigure stream response.

FieldTypeLabelDescription
configStreamConfigStream configuration.

SequencedRecord

Record retrieved from a stream.

FieldTypeLabelDescription
seq_numuint64Sequence number for this record.
headersHeaderrepeatedSeries of name-value pairs for this record.
bodybytesBody of this record.

SequencedRecordBatch

A batch of sequenced records.

FieldTypeLabelDescription
recordsSequencedRecordrepeatedBatch of sequenced records.

StreamConfig

Stream configuration.

FieldTypeLabelDescription
storage_classStorageClassStorage class for recent writes. This is the main cost:performance knob in S2.
ageuint64Age in seconds for automatic trimming of records older than this threshold. If set to 0, the stream will have infinite retention.

StreamInfo

Stream information.

FieldTypeLabelDescription
namestringStream name.
created_atuint32Creation time in seconds since Unix epoch.
deleted_atuint32optionalDeletion time in seconds since Unix epoch, if the stream is being deleted.

BasinState

Current state of the basin.

NameNumberDescription
BASIN_STATE_UNSPECIFIED0Unspecified.
BASIN_STATE_ACTIVE1Basin is active.
BASIN_STATE_CREATING2Basin is being created.
BASIN_STATE_DELETING3Basin is being deleted.

StorageClass

Storage class for recent writes.

NameNumberDescription
STORAGE_CLASS_UNSPECIFIED0Unspecified, which is currently overridden to STORAGE_CLASS_EXPRESS.
STORAGE_CLASS_STANDARD1Standard, which offers end-to-end latencies under 500 ms.
STORAGE_CLASS_EXPRESS2Express, which offers end-to-end latencies under 50 ms.