Package

com.ironcorelabs.davenport

db

Permalink

package db

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. db
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final case class CommitVersion(value: Long) extends AnyVal with Product with Serializable

    Permalink

    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.

  2. final case class CommitVersionMismatch(key: Key) extends DBError with Product with Serializable

    Permalink

    If the CommitVersion for an update doesn't match.

  3. final case class CreateDoc(key: Key, doc: RawJsonString) extends DBOp[\/[DBError, DBValue]] with Product with Serializable

    Permalink
  4. final case class DBDocument[A](key: Key, commitVersion: CommitVersion, data: A) extends Product with Serializable

    Permalink

    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.

  5. sealed abstract class DBError extends AnyRef

    Permalink

    ADT for errors that might happen in working with our grammar.

  6. sealed trait DBOp[A] extends AnyRef

    Permalink

    Any database operation must be represented by a DBOp

  7. type DBOps[A] = Free[[x]Coyoneda[DBOp, x], A]

    Permalink

    A Free Co-yoneda of DBOp classes

  8. type DBProg[A] = EitherT[DBOps, DBError, A]

    Permalink

    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.

  9. type DBValue = DBDocument[RawJsonString]

    Permalink

    Convienent alias for the document type we return.

  10. final case class DeserializationError(key: Key, errorMessage: String) extends DBError with Product with Serializable

    Permalink

    Deserialization failures will be wrapped up in this type.

    Deserialization failures will be wrapped up in this type.

    key

    The key that was requested

    errorMessage

    The underlying failure message from the parse failure.

  11. final case class GeneralError(ex: Throwable) extends DBError with Product with Serializable

    Permalink

    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.

  12. final case class GetCounter(key: Key) extends DBOp[\/[DBError, Long]] with Product with Serializable

    Permalink
  13. final case class GetDoc(key: Key) extends DBOp[\/[DBError, DBValue]] with Product with Serializable

    Permalink
  14. final case class IncrementCounter(key: Key, delta: Long = 1) extends DBOp[\/[DBError, Long]] with Product with Serializable

    Permalink
  15. final case class Key(value: String) extends AnyVal with Product with Serializable

    Permalink

    Just a string.

    Just a string. This is used for type safety.

  16. final case class RawJsonString(value: String) extends AnyVal with Product with Serializable

    Permalink

    Just a string.

    Just a string. This is used for type safety.

  17. final case class RemoveKey(key: Key) extends DBOp[\/[DBError, Unit]] with Product with Serializable

    Permalink
  18. final case class UpdateDoc(key: Key, doc: RawJsonString, commitVersion: CommitVersion) extends DBOp[\/[DBError, DBValue]] with Product with Serializable

    Permalink
  19. final case class ValueExists(key: Key) extends DBError with Product with Serializable

    Permalink

    If a value already exists at key.

  20. final case class ValueNotFound(key: Key) extends DBError with Product with Serializable

    Permalink

    If no value was found at the requested key.

Value Members

  1. object DBDocument extends Serializable

    Permalink
  2. implicit val DBOpsMonad: Monad[DBOps]

    Permalink
  3. object RawJsonString extends Serializable

    Permalink
  4. object batch

    Permalink

    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.

  5. def createDoc(k: Key, doc: RawJsonString): DBProg[DBValue]

    Permalink

    Create a document with the given key

  6. def getCounter(k: Key): DBProg[Long]

    Permalink

    Fetch a counter from the DB given a key

  7. def getDoc(k: Key): DBProg[DBValue]

    Permalink

    Return a document given some key

  8. def incrementCounter(k: Key, delta: Long = 1): DBProg[Long]

    Permalink

    Increment a counter in the DB and return for some key and delta

  9. def liftDisjunction[A](either: \/[DBError, A]): DBProg[A]

    Permalink
  10. def liftIntoDBProg[A](either: \/[Throwable, A]): DBProg[A]

    Permalink
  11. def liftIntoDBProg[A](opt: Option[A], errormessage: String): DBProg[A]

    Permalink
  12. def liftIntoDBProg[A](opt: Option[A], dbError: DBError): DBProg[A]

    Permalink

    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.

  13. def modifyDoc(k: Key, f: (RawJsonString) ⇒ RawJsonString): DBProg[DBValue]

    Permalink

    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.

  14. def removeKey(k: Key): DBProg[Unit]

    Permalink

    Remove a doc from the DB given its key

  15. def updateDoc(k: Key, doc: RawJsonString, commitVersion: CommitVersion): DBProg[DBValue]

    Permalink

    Update a doc given its key, new value, and correct commitVersion

Inherited from AnyRef

Inherited from Any

Ungrouped