View Source ExWal.Recycler protocol (ex_wal v0.3.0)

The Recycler protocol defines the behaviour of a WAL file recycler.

Summary

Types

t()

All the types that implement this protocol.

Functions

get_min returns the current minimum log number that is allowed to be recycled.

Add attempts to recycle the log file specified by file. Returns true if the log file should not be deleted (i.e. the log is being recycled), and false otherwise.

Peek returns the log at the head of the recycling queue, or the zero value fileInfo and false if the queue is empty.

Pop removes the log number at the head of the recycling queue, enforcing that it matches the specified seq. An error is returned of the recycling queue is empty or the head log number does not match the specified one.

set_min sets the minimum log number that is allowed to be recycled.

Types

@type log() :: ExWal.Models.VirtualLog.t()
@type log_num() :: ExWal.Models.VirtualLog.log_num()
@type t() :: term()

All the types that implement this protocol.

Functions

@spec add(impl :: t(), log :: log()) :: boolean()
@spec get_min(impl :: t()) :: log_num()

get_min returns the current minimum log number that is allowed to be recycled.

Link to this function

initialize(impl, capacity)

View Source
@spec initialize(impl :: t(), capacity :: non_neg_integer()) :: :ok

Add attempts to recycle the log file specified by file. Returns true if the log file should not be deleted (i.e. the log is being recycled), and false otherwise.

@spec peek(impl :: t()) :: log() | nil

Peek returns the log at the head of the recycling queue, or the zero value fileInfo and false if the queue is empty.

@spec pop(impl :: t()) :: log() | nil

Pop removes the log number at the head of the recycling queue, enforcing that it matches the specified seq. An error is returned of the recycling queue is empty or the head log number does not match the specified one.

@spec set_min(impl :: t(), log_num :: log_num()) :: :ok

set_min sets the minimum log number that is allowed to be recycled.

@spec stop(impl :: t()) :: :ok