ex_sync v0.0.2 ExSync.Store behaviour

Specification for Exsync Stores. Stores are being used to save and retrieve Server Documents

Summary

Callbacks

Retrieves the document from the store by its ID

Similarly to the Elixir get_and_update/2 function (e.g. in Access, Agent, Doct, …) this function gets the document from storage, applies a function to it and saves it back to the storage

Types

error :: atom

Callbacks

get(arg0)

Specs

get(String.t) :: Map.t

Retrieves the document from the store by its ID.

get_and_update(any, list)

Specs

get_and_update(any, (... -> any)) ::
  {:ok | Map.t} |
  {:error | error}

Similarly to the Elixir get_and_update/2 function (e.g. in Access, Agent, Doct, …) this function gets the document from storage, applies a function to it and saves it back to the storage.

Reading and writing should be done in a transaction, as the document changing between the read and the write command will cause trouble that is extremely painful to track down.