-
Notifications
You must be signed in to change notification settings - Fork 454
Server api
mluto edited this page May 23, 2013
·
5 revisions
Complete me based on src/server/model.coffee
All these methods operate on documents, except for closeDb
and flushDb
.
-
docName
, the name of the doc to create -
type
, the type of the doc to create -
meta
(optional), ??? -
callback
, called with(error, doc)
-
docName
, the name of the doc to delete -
callback
, called with(error)
WARNING: This isn't well supported throughout the code. E.g.: Streaming clients aren't told about the deletion and subsequent op submissions will fail.
-
docName
, the name of the doc to get ops from -
start
, first op to get -
end
, can be null, which means 'get me all ops from start'. -
callback
, called with(error, ops)
Gets all operations from [start
...end
]. (That is, its not inclusive.)
Each op returned is in the form {op:o, meta:m, v:version}
.
docName
-
callback
, called with(error, {v: <version>, type: <type>, snapshot: <snapshot>, meta: <meta>})
Returns the current state (version, type, content and meta) of this document.
docName
-
callback
, called with(error, version)
docName
-
opData
, the operation to apply -
callback
, called with(error, applied version #)
Applies the OT-op given in opData
the current content of this document, opData
has to be structured like this:
{
op: [{ /* ... */ }], // array of ops to apply (has to be an array)
v: 0, // version to apply the op on
meta: null
}
See JSON-Operations for further documentation of the op
-value.
docName
metaOpData
callback
docName
version
listener
callback
docName
listener