[docs]@dataclass(slots=True)classRecord:""" Record to be appended to a stream. """#: Body of this record.body:bytes#: Series of name-value pairs for this record.headers:list[tuple[bytes,bytes]]=field(default_factory=list)
[docs]@dataclass(slots=True)classAppendInput:""" Used in the parameters to :meth:`.Stream.append` and :meth:`.Stream.append_session`. """#: Batch of records to append atomically, which must contain at least one record,#: and no more than 1000. The size of the batch must not exceed 1MiB of :func:`.metered_bytes`.records:list[Record]#: Enforce that the sequence number issued to the first record in the batch matches this value.match_seq_num:int|None=None#: Enforce a fencing token, which must have been previously set by a ``fence`` command record.fencing_token:bytes|None=None
[docs]@dataclass(slots=True)classAppendOutput:""" Returned from :meth:`.Stream.append`. (or) Yielded from :meth:`.Stream.append_session`. """#: Sequence number of first record appended.start_seq_num:int#: Sequence number of last record appended + 1.#: ``end_seq_num - start_seq_num`` will be the number of records in the batch.end_seq_num:int#: Sequence number of last durable record on the stream + 1.#: This can be greater than ``end_seq_num`` in case of concurrent appends.next_seq_num:int
[docs]@dataclass(slots=True)classReadLimit:""" Used in the parameters to :meth:`.Stream.read` and :meth:`.Stream.read_session`. If both ``count`` and ``bytes`` are specified, either limit may be hit. """#: Number of records.count:int|None=None#: Cumulative size of records calculated using :func:`.metered_bytes`.bytes:int|None=None
[docs]@dataclass(slots=True)classSequencedRecord:""" Record read from a stream. """#: Sequence number for this record.seq_num:int#: Body of this record.body:bytes#: Series of name-value pairs for this record.headers:list[tuple[bytes,bytes]]
[docs]@dataclass(slots=True)classPage(Generic[T]):""" Page of items. """#: List of items of any type T.items:list[T]#: If True, it means that there are more pages.has_more:bool
[docs]classBasinState(DocEnum):""" Current state of a basin. """UNSPECIFIED=0ACTIVE=1CREATING=2DELETING=3
[docs]@dataclass(slots=True)classStreamInfo:""" Stream information. """#: Stream name.name:str#: Creation time.created_at:datetime#: Deletion time, if this stream is being deleted.deleted_at:datetime|None
[docs]classStorageClass(DocEnum):""" Storage class for recent appends. """UNSPECIFIED=0,"``UNSPECIFIED`` gets overridden to ``EXPRESS``."STANDARD=1,"Offers end-to-end latencies under 500 ms."EXPRESS=2,"Offers end-to-end latencies under 50 ms."
[docs]@dataclass(slots=True)classStreamConfig:""" Current configuration of a stream. """#: Storage class for this stream.storage_class:StorageClass#: Thresold for automatic trimming of records in this stream.retention_age:timedelta
[docs]@dataclass(slots=True)classBasinConfig:""" Current configuration of a basin. """#: Default configuration for streams in this basin.default_stream_config:StreamConfig
[docs]classCloud(DocEnum):""" Cloud in which the S2 service runs. """AWS=1
[docs]@classmethod@fallibledeffor_cloud(cls,cloud:Cloud)->"Endpoints":""" Construct S2 endpoints for the given cloud. Args: cloud: Cloud in which the S2 service runs. """returncls(_account_authority(cloud),_basin_authority(cloud),)