Bedrock.DataPlane.Log.Shale.Writer (bedrock v0.5.3)
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.
Types
@type t() :: %Bedrock.DataPlane.Log.Shale.Writer{ bytes_remaining: pos_integer(), fd: File.file_descriptor(), 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(), opts :: keyword()) :: {:ok, t()} | {:error, File.posix()}