Skip to content

Commit

Permalink
OAK-1852 DocumentStore API: improve documentation of keys
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1651594 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
thomasmueller committed Jan 14, 2015
1 parent 2fccc61 commit 2801a45
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,19 @@
import com.google.common.collect.Maps;

/**
* A document corresponds to a node stored in the DocumentMK. A document contains
* all the revisions of a node stored in the {@link DocumentStore}.
* A document corresponds to a node stored in the DocumentNodeStore. A document
* contains all the revisions of a node stored in the {@link DocumentStore}.
*/
public class Document implements CacheValue {

/**
* The node id, which contains the depth of the path
* (0 for root, 1 for children of the root), and then the path.
* The name of the field that contains the document id (the primary key /
* the key). The id uniquely identifies a document within a collection. The
* requirements and limits of the id are documented in the
* {@link DocumentStore} class.
*
* For nodes, the document id contains the depth of the path (0 for root, 1
* for children of the root), and then the path.
*/
public static final String ID = "_id";

Expand All @@ -60,15 +65,19 @@ public class Document implements CacheValue {
private AtomicBoolean sealed = new AtomicBoolean(false);

/**
* @return the id of this document or <code>null</code> if none is set.
* Get the id (the primary key) of this document.
*
* @return the id or <code>null</code> if none is set.
*/
@CheckForNull
public String getId() {
return (String) get(ID);
}

/**
* @return the modification count of this document or <code>null</code> if
* Get the modification count of this document.
*
* @return the count or <code>null</code> if
* none is set.
*/
@CheckForNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@
* document. That is, an implementation does not have to guarantee atomicity of
* the entire effect of a method call. A method that fails with an exception may
* have modified just some documents and then abort. However, an implementation
* must not modify a document partially. Either the complete update operation
* is applied to a document or no modification is done at all.
* must not modify a document partially. Either the complete update operation is
* applied to a document or no modification is done at all.
* <p>
* Even though none of the methods declare an exception, they will still throw
* an implementation specific runtime exception when the operations fails (e.g.
* an I/O error occurs).
* <p>
* For keys, the maximum length is 512 bytes in the UTF-8 representation.
* The key is the id of a document. Keys are opaque strings. All characters are
* allowed. Leading and trailing whitespace is allowed. For keys, the maximum
* length is 512 bytes in the UTF-8 representation (in the latest Unicode
* version).
*/
public interface DocumentStore {

Expand Down

0 comments on commit 2801a45

Please sign in to comment.