View Source Kvasir.Offset (kvasir v0.0.18)

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

@type partition_offset() :: :earliest | :latest | pos_integer()
@type 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

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
@spec empty?(t()) :: boolean()

Check whether an offset is empty.

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

Link to this function

set(o, partition, offset)

View Source