View Source ExWal.Models.Entry (ex_wal v0.1.4)

entry struct for each record in WAL

Description

  • index: the index of the entry, monotonically increasing.
  • data: the binary data of the entry
  • cache: This field only exists in hot data and is lost once the entry is persisted to cold data. This field can be used in the scenario of "nearby reading", when the data that was just written into WAL is read, the value of cache can be directly used, reducing the consumption of repeated serialization.

Summary

Types

@type t() :: %ExWal.Models.Entry{
  cache: any(),
  data: binary(),
  index: non_neg_integer()
}

Functions

Link to this function

new(index, data, cache \\ nil)

View Source
@spec new(non_neg_integer(), binary(), any()) :: t()

Create a new entry

Examples

iex> Entry.new(1, "Hello Elixir")
%Entry{index: 1, data: "Hello Elixir"}