Permalink
Browse files

Document rev_meta

  • Loading branch information...
1 parent 179c192 commit 0689f1616879e3d1b99d7dcaa87d519fdfafbdf6 @apage43 apage43 committed Feb 13, 2012
Showing with 20 additions and 9 deletions.
  1. +20 −9 csdata.md
View
@@ -2,13 +2,13 @@
Struct members not listed should be considered internal to Couchstore.
-### sized_buf
+### sized\_buf
struct sized_buf {
char* buf;
size_t size;
}
-Couchstore uses `sized_buf`s to point to data buffers.
+Couchstore uses `sized_buf`s to point to data buffers.
### DocInfo
struct DocInfo {
@@ -27,17 +27,29 @@ Couchstore uses `sized_buf`s to point to data buffers.
* `deleted` - 1 if document should be considered "deleted" and not subject to indexing, otherwise 0.
* `content_meta` - Number field used to store flags indicating metadata about the document content (is it JSON, etc.)
-#### The content_meta field
+#### The `content_meta` field
* The least-significant two bits are used to encode why/whether the body is or is not JSON
- * 0 - Document body *is* JSON
- * 1 - Inserted data was not valid JSON
- * 2 - Inserted data was valid JSON, but contained a key reserved for internal use, such as one with a `$` prefix.
- * 3 - The document was inserted in non-JSON mode.
-* If the most-significant bit is set the document body data has been compressed with snappy.
+ * 0 - Document body *is* JSON
+ * 1 - Inserted data was not valid JSON
+ * 2 - Inserted data was valid JSON, but contained a key reserved for internal use, such as one with a `$` prefix.
+ * 3 - The document was inserted in non-JSON mode.
+* If the most-significant bit is set the document body data has been compressed with snappy.
When saving documents with `save_doc` or `save_docs`, `id`, `rev_seq`, `rev_meta`, `deleted`, and `content_meta` must be set on the `DocInfo`s passed to Couchstore. The `db_seq` is determined at insert time.
+#### The `rev_meta` field
+
+[128 bit binary value]
+| 64 bits | 32 bits | 32 bits |
+-----------|------------|------------|
+ CAS Value | Expiration | User flags |
+
+ All values are Big Endian.
+
+ * CAS Value - Random nonce value set by Memcached, used to allow ensuring value has not been modified since it was read when writing.
+ * Expiration - 32 bit timestamp for value expiry time. 0 if item does not expire.
+ * User flags - Memcache API allows users to set this 32 bit number along with values, it is not used by memcached internally.
### Doc
struct Doc {
@@ -63,4 +75,3 @@ When saving documents with `save_doc` or `save_docs`, `id`, `rev_seq`, `rev_meta
Documented in `include/libcouchstore/couch_db.h`
-

0 comments on commit 0689f16

Please sign in to comment.