Bedrock.DataPlane.Log.Shale.State (bedrock v0.7.0)
View SourceInternal state struct for Shale log servers.
Summary
Functions
The cut-interval width this log operates on, in microseconds of version-time.
Types
@type init_state() :: :initialized | {:retrying, attempt :: pos_integer()}
@type mode() :: :locked | :running | :recovering
@type t() :: %Bedrock.DataPlane.Log.Shale.State{ active_segment: Bedrock.DataPlane.Log.Shale.Segment.t() | nil, available_after: Bedrock.version(), cluster: module(), cut_interval_us: pos_integer() | nil, demux: pid() | nil, demux_supervisor: pid() | nil, director: Bedrock.ControlPlane.Director.ref() | nil, epoch: Bedrock.epoch() | nil, foreman: Bedrock.Service.Foreman.ref(), id: Bedrock.Service.Worker.id(), init_state: init_state(), last_version: Bedrock.version(), min_durable_version: Bedrock.version() | nil, mode: mode(), object_storage: module() | nil, oldest_version: Bedrock.version(), otp_name: Bedrock.Service.Worker.otp_name(), params: %{default_pull_limit: pos_integer(), max_pull_limit: pos_integer()}, path: String.t(), pending_pushes: %{ required(Bedrock.version()) => {encoded_transaction :: Bedrock.DataPlane.Transaction.encoded(), reply_token :: term()} }, pending_transactions: term(), reject_pushes_above_lag_us: non_neg_integer() | nil, segment_loader: (String.t() -> {:ok, [Bedrock.DataPlane.Log.Shale.Segment.t()]} | {:error, term()}) | nil, segment_recycler: Bedrock.DataPlane.Log.Shale.SegmentRecycler.server() | nil, segments: [Bedrock.DataPlane.Log.Shale.Segment.t()], waiting_pullers: %{ required(Bedrock.version()) => [ {Bedrock.timestamp_in_ms(), reply_to_fn :: (any() -> :ok), opts :: [limit: integer(), timeout: timeout()]} ] }, writer: Bedrock.DataPlane.Log.Shale.Writer.t() | nil, writer_opts: keyword() }
Functions
@spec cut_interval_us(t()) :: pos_integer()
The cut-interval width this log operates on, in microseconds of version-time.
The single resolution point for the default. The WAL's segment-roll boundary and the Demux's cut boundary are the SAME boundary — a segment holds exactly one cut bucket, which is what lets trimming drop history at the cut cadence even though the active segment is trim-immune. Two independent reads of "the default" would hold only by coincidence, and would diverge the moment a log's Demux were configured with a different width.