Kvasir.Offset (kvasir v0.0.15) View Source

Link to this section Summary

Functions

Examples

iex> a = create(%{0 => 24, 1 => 37})
iex> b = create(%{0 => 24, 1 => 37})
iex> compare(a, b)
:eq
iex> a = create(%{0 => 12, 1 => 23})
iex> b = create(%{0 => 24, 1 => 37})
iex> compare(a, b)
:lt
iex> a = create(%{0 => 24, 1 => 37})
iex> b = create(%{0 => 12, 1 => 23})
iex> compare(a, b)
:gt

Using :earliest

Check whether an offset is empty.

Compare two partition offset values and return the lowest. (earliest)

Link to this section Types

Specs

partition_offset() :: :earliest | :latest | pos_integer()

Specs

t() :: %Kvasir.Offset{partitions: term()}

Link to this section Functions

Link to this function

chunk(offset, chunks \\ 0)

View Source
Link to this function

chunk_every(offset, every)

View Source
Link to this function

compare(partition_a, partition_b)

View Source

Examples

iex> a = create(%{0 => 24, 1 => 37})
iex> b = create(%{0 => 24, 1 => 37})
iex> compare(a, b)
:eq
iex> a = create(%{0 => 12, 1 => 23})
iex> b = create(%{0 => 24, 1 => 37})
iex> compare(a, b)
:lt
iex> a = create(%{0 => 24, 1 => 37})
iex> b = create(%{0 => 12, 1 => 23})
iex> compare(a, b)
:gt

Using :earliest:

iex> a = create(%{0 => :earliest})
iex> b = create(%{0 => 0})
iex> compare(a, b)
:lt

iex> a = create(%{0 => :earliest})
iex> b = create(%{0 => :earliest})
iex> compare(a, b)
:eq
Link to this function

create(partition, offset)

View Source

Specs

empty?(t()) :: boolean()

Check whether an offset is empty.

Specs

Compare two partition offset values and return the lowest. (earliest)

Link to this function

set(o, partition, offset)

View Source