Bedrock.DataPlane.Log.Shale.Writer (bedrock v0.6.0)
View SourceA struct that represents a writer for a segment.
Summary
Types
A Writer is a handle to a segment that can be used to write transcations
to the segment. It is a stateful object that keeps track of the current
write offset and the number of bytes remaining in the segment.
Functions
Persists an empty segment header and its replay cursor.
Types
@type t() :: %Bedrock.DataPlane.Log.Shale.Writer{ bytes_remaining: pos_integer(), fd: File.file_descriptor(), pwrite_fun: (File.file_descriptor(), non_neg_integer(), iodata() -> :ok | {:error, File.posix()}), sync_fun: (File.file_descriptor() -> :ok | {:error, File.posix()}), write_offset: pos_integer() }
A Writer is a handle to a segment that can be used to write transcations
to the segment. It is a stateful object that keeps track of the current
write offset and the number of bytes remaining in the segment.
Functions
@spec append(t(), Bedrock.DataPlane.Transaction.encoded(), Bedrock.version()) :: {:ok, t()} | {:error, :segment_full} | {:error, File.posix()}
@spec close(writer :: t() | nil) :: :ok | {:error, File.posix()}
@spec open( path_to_file :: String.t(), previous_version :: Bedrock.version(), opts :: keyword() ) :: {:ok, t()} | {:error, File.posix()}
@spec sync(t()) :: :ok | {:error, File.posix()}
Persists an empty segment header and its replay cursor.