gnieh.sohva.dm

DesignManager

Related Doc: package dm

trait DesignManager[Result[_]] extends AnyRef

A design manager allows people to easily manage design documents stored in a CouchDB database. It allows for storing, updating, deleting designs, views and more from a bunch of files stored in a directory. The structure of the directory is as follows:

base
|-- design1
|   |-- revision.json
|   |-- views
|   |   |-- view1
|   |   |   `-- map.js
|   |   `-- view2
|   |       |-- map.js
|   |       `-- reduce.js
`-- design2
    |-- filters
    |   |-- filter1.js
    |   `-- filter2.js
    |-- language.json
    |-- lists
    |   |-- list1.js
    |   `-- list2.js
    |-- rewrites
    |   |-- rewrite1.json
    |   |-- rewrite2.json
    |   `-- rewrite3.json
    |-- shows
    |   `-- show.js
    |-- updates
    |   `-- update.js
    |-- validate_doc_update.js
    `-- views
        `-- view
            `-- map.js

The language.json file must contain a json object with two fields:

sohva {
  dm {
    extensions {
      javascript = js
      coffeescript = coffee
    }
  }
}

All js (or whatever the language is) files must contain the definition of a single function corresponding to the document field. It also allows for bi-directional synchronization between design documents in the database and the ones described in the directory. The rewrite objects are sorted alphabetically by the file name in the array.

The revision.json file, if present, must contain a string specifying the last known revision in the database that corresponds to this version of the design document. This allows for more efficient synchronization of design documents. It is automatically added or updated when a design document is imported from a database or synchronized if trackRevisions is set to true. If it is not present, and the document also exists in the database, upon synchronization, the local version of the design document is taken as reference in case of concurrent modifications and is added if missing in the database.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. DesignManager
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract val basedir: File

  2. abstract def createBasedir(): Result[Boolean]

    Creates the base directory if it does not exists.

    Creates the base directory if it does not exists. Returns true iff the base directory was actually created, false otherwise. If a file with the given path exists, or it is impossible to create the base directory, an exception is thrown

  3. abstract def databaseDesigns: Result[List[String]]

    Returns the list of design documents that currently exists in the database

  4. abstract val dbName: String

  5. abstract def download(): Result[Unit]

    Download the design documents from the database into the base directory.

    Download the design documents from the database into the base directory. If a conflict occurs between local and remote version, the remote version takes precedence and replaces the local version. If this manager is configured to track revisions, the revision file is created or updated to the current revision. Otherwise, it is removed if it exists.

  6. abstract def managedDesigns: List[String]

    Returns the list of design document names that are currently knwown and managed.

    Returns the list of design document names that are currently knwown and managed. Every managed design document has its counterpart in the base directory. All directory directly located under the base directory are considered to be managed designs.

  7. abstract def synchronize(): Result[Unit]

    Synchronize managed design documents with the database.

    Synchronize managed design documents with the database. This performs a bi-directional synchronization and creates or updates design documents as needed. This can only work when revision tracking is enabled. In case of conflict, a structural merge is performed, with the local version winning concurrent modifications.

  8. abstract val trackRevisions: Boolean

  9. abstract def upload(force: Boolean = false): Result[Unit]

    Upload the design documents to the database from the base directory.

    Upload the design documents to the database from the base directory. If a conflict occurs between local and remote version, the local version takes precedence and replaces the remote version. If this manager is configured to track revisions, the revision file is created or updated to the current revision. Otherwise, it is removed if it exists. If the force parameter is set to true, upload is performed even if the designs didn't change since last synchronization.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  16. def toString(): String

    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped