Revisionair v0.13.1 Revisionair.Storage.Agent

A simple implementation of the Revisionair.Storage protocol that builds on the Agent module.

This is thus a very ephemeral persistence layer, which, though paradoxical and maybe not very practical in real-life applications, is at least very useful as a simple example and for testing.

Summary

Functions

Deletes all revisions for the given {item_type, item_id}

Returns a {structure, metadata}-list of all revisions of the given struture, newest-to-oldest

Returns the newest revision for the given {item_type, item_id} combination

Stores a new revision for the given map, uniquely identified by the {item_type, item_id} combination

Functions

delete_all_revisions_of(item_type, item_id, opts)

Deletes all revisions for the given {item_type, item_id}

Callback implementation for Revisionair.Storage.delete_all_revisions_of/3.

get_revision(item_type, item_id, revision, opts)

Callback implementation for Revisionair.Storage.get_revision/4.

list_revisions(item_type, item_id, opts)

Returns a {structure, metadata}-list of all revisions of the given struture, newest-to-oldest.

The metadata field is required to be a map, which has to include a :revision field.

Callback implementation for Revisionair.Storage.list_revisions/3.

newest_revision(item_type, item_id, opts)

Returns the newest revision for the given {item_type, item_id} combination.

This callback is supplied decoupled from list_revisions for efficiency, because it is very common to check only the newest revision.

Callback implementation for Revisionair.Storage.newest_revision/3.

start_link()
store_revision(structure, item_type, item_id, metadata, opts)

Stores a new revision for the given map, uniquely identified by the {item_type, item_id} combination.

Callback implementation for Revisionair.Storage.store_revision/5.