Licet.GC (Licet v0.1.0)

Copy Markdown View Source

Garbage collection of old relationship history.

Licet keeps deleted and expired relationships, and the snapshots of past writes, for gc_window seconds, so that tokens from that window can still be read exactly. Every instance runs a collector that removes older history every gc_interval milliseconds, in batches of gc_batch rows.

On several nodes, each pass takes a Postgres advisory lock, so only one node collects at a time. Set gc_interval: false to disable automatic passes, for example in tests or to trigger them from your own scheduler with collect/1.

Summary

Functions

Runs one collection pass on instance now and waits for it.

Functions

collect(instance)

@spec collect(atom()) :: :ok | :locked | {:error, Licet.Error.t()}

Runs one collection pass on instance now and waits for it.

Returns :locked when another node holds the lock and is collecting, and {:error, %Licet.Error{reason: :not_started}} when no instance with that name is running.

Examples

Licet.GC.collect(MyApp.Licet)
#=> :ok