A commit version of an existing value in the db.
A commit version of an existing value in the db.
Couchbase calls this a CAS (check and save) as it is passed back in with requests to update a value. If the value has been changed by another actor, then the update fails and the caller is left to handle the conflict.
If the CommitVersion for an update doesn't match.
A document that's either destined to be put into the DB or came out of the DB.
A document that's either destined to be put into the DB or came out of the DB. Key - The key where the document is stored. commitVersion - The CommitVersion of the current document data - The data stored in the document, typically RawJsonString when it comes out of the DB.
ADT for errors that might happen in working with our grammar.
Any database operation must be represented by a DBOp
A Free Co-yoneda of DBOp classes
The basic building block sent to the datastore.
The basic building block sent to the datastore.
Effectively this captures expected return type of DBError \/ A
and a series of DBOp classes or functions combined together.
When passed to an datastore such as MemDatastore
or CouchDatastore
, these are executed.
Convienent alias for the document type we return.
Deserialization failures will be wrapped up in this type.
Deserialization failures will be wrapped up in this type.
The key that was requested
The underlying failure message from the parse failure.
All other errors will be exceptions that come out of the underlying store.
All other errors will be exceptions that come out of the underlying store. They'll be wrapped up in this type.
Just a string.
Just a string. This is used for type safety.
Just a string.
Just a string. This is used for type safety.
If a value already exists at key.
If no value was found at the requested key.
Object that contains batch operations for DB.
Object that contains batch operations for DB. They have been separated out because they cannot be mixed with
DBProg
operations without first lifting them into a process via liftToProcess
.
Create a document with the given key
Fetch a counter from the DB given a key
Return a document given some key
Increment a counter in the DB and return for some key and delta
The liftIntoDBProg
operations allow any function or value to be deferred to
the executor.
The liftIntoDBProg
operations allow any function or value to be deferred to
the executor.
This will most often be used when using for comprehensions mixing DBOp operations with other data extraction such as json de/serialization.
Convenience function to fetch a doc and transform it via a function f
Convenience function to fetch a doc and transform it via a function f
In practice, this is more an example showing how to build a function like this. More commonly a higher level class that can be serialized to the db will have a modify function that transforms and calls this under the hood.
Remove a doc from the DB given its key
Update a doc given its key, new value, and correct commitVersion