public final class NodeDocument extends Document
| Modifier and Type | Class and Description |
|---|---|
static class |
NodeDocument.Children
The list of children for a node.
|
static class |
NodeDocument.SplitDocType
A document which is created from splitting a main document can be classified
into multiple types depending on the content i.e.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
COLLISIONS
Revision collision markers set by commits with modifications, which
overlap with un-merged branch commits.
|
static String |
DELETED_ONCE
Flag indicating that whether this node was ever deleted.
|
static String |
HAS_BINARY_FLAG |
static long |
HAS_BINARY_VAL |
static String |
MAX_ID_VALUE
All NodeDocument ID value would be less than this value
It can be used as endKey in DocumentStore#query methods
|
static String |
MIN_ID_VALUE
All NodeDocument ID value would be greater than this value
It can be used as startKey in DocumentStore#query methods
|
static String |
MODIFIED_IN_SECS
The modified time in seconds (5 second resolution).
|
static NodeDocument |
NULL
Marker document, which indicates the document does not exist.
|
static String |
PATH
The node path, in case the id can not be converted to a path.
|
static String |
SD_MAX_REV_TIME_IN_SECS
Property name which refers to timestamp (long) of the latest revision kept
in the document
|
static String |
SD_TYPE
Defines the type of split document.
|
| Constructor and Description |
|---|
NodeDocument(@NotNull DocumentStore store,
long creationTime)
Required for serialization
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addCollision(@NotNull UpdateOp op,
@NotNull Revision revision,
@NotNull Revision other)
Add a collision marker for the given
revision. |
String |
asString() |
boolean |
containsRevision(@NotNull Revision revision)
|
static NodeDocument |
fromString(DocumentStore store,
String s) |
@Nullable String |
getCommitRootPath(Revision revision)
Returns the commit root path for the given
revision or
null if this document does not have a commit root entry for
the given revision. |
long |
getCreated() |
long |
getLastCheckTime()
Returns the last time when this object was checked for consistency.
|
@NotNull Map<Integer,Revision> |
getLastRev() |
@Nullable Revision |
getLiveRevision(RevisionContext context,
RevisionVector readRevision,
Map<Revision,String> validRevisions,
org.apache.jackrabbit.oak.plugins.document.LastRevs lastRevs)
Get the earliest (oldest) revision where the node was alive at or before
the provided revision, if the node was alive at the given revision.
|
@NotNull Set<Revision> |
getLocalBranchCommits()
Returns the branch commit entries on this document
(
BRANCH_COMMITS). |
@NotNull String |
getMainPath()
Returns the path of the main document if this document is part of a _prev
history tree.
|
@Nullable Long |
getModified()
See also
MODIFIED_IN_SECS. |
static long |
getModifiedInSecs(long timestamp)
Return time in seconds with 5 second resolution
|
@Nullable DocumentNodeState |
getNodeAtRevision(@NotNull DocumentNodeStore nodeStore,
@NotNull RevisionVector readRevision,
@Nullable Revision lastModified)
Returns a
DocumentNodeState as seen at the given
readRevision. |
String |
getPath() |
NodeDocument.SplitDocType |
getSplitDocType()
Determines the type of split document
|
@NotNull Map<Revision,String> |
getValueMap(@NotNull String key)
Gets the value map for the given key.
|
boolean |
hasAllRevisionLessThan(long maxRevisionTime)
Checks if revision time of all entries in this document is less than the passed
time
|
boolean |
hasBeenModifiedSince(long lastModifiedTime)
Checks if this document has been modified after the given lastModifiedTime
|
boolean |
hasBinary() |
boolean |
hasChildren()
Returns
true if this node possibly has children. |
static boolean |
isCommitRootEntry(String name) |
static boolean |
isDeletedEntry(String name) |
static boolean |
isLastRevEntry(String name) |
static boolean |
isRevisionsEntry(String name) |
boolean |
isSplitDocument()
Determines if this document is a split document
|
void |
markUpToDate(long checkTime)
Mark this instance as up-to-date (matches the state in persistence
store).
|
static void |
removeBranchCommit(@NotNull UpdateOp op,
@NotNull Revision revision) |
static void |
removeCollision(@NotNull UpdateOp op,
@NotNull Revision revision) |
static void |
removeCommitRoot(@NotNull UpdateOp op,
@NotNull Revision revision) |
static void |
removeDeleted(@NotNull UpdateOp op,
@NotNull Revision revision) |
static void |
removePrevious(@NotNull UpdateOp op,
@NotNull org.apache.jackrabbit.oak.plugins.document.Range range) |
static void |
removePrevious(@NotNull UpdateOp op,
@NotNull Revision revision) |
static void |
removeRevision(@NotNull UpdateOp op,
@NotNull Revision revision) |
static void |
removeStalePrevious(@NotNull UpdateOp op,
@NotNull Revision revision) |
static void |
setBranchCommit(@NotNull UpdateOp op,
@NotNull Revision revision) |
static void |
setChildrenFlag(@NotNull UpdateOp op,
boolean hasChildNode) |
static void |
setCommitRoot(@NotNull UpdateOp op,
@NotNull Revision revision,
int commitRootDepth) |
static void |
setDeleted(@NotNull UpdateOp op,
@NotNull Revision revision,
boolean deleted) |
static void |
setDeletedOnce(@NotNull UpdateOp op) |
static void |
setHasBinary(@NotNull UpdateOp op) |
static void |
setLastRev(@NotNull UpdateOp op,
@NotNull Revision revision) |
static void |
setModified(@NotNull UpdateOp op,
@NotNull Revision revision) |
static void |
setPrevious(@NotNull UpdateOp op,
@NotNull org.apache.jackrabbit.oak.plugins.document.Range range) |
static void |
setRevision(@NotNull UpdateOp op,
@NotNull Revision revision,
@NotNull String commitValue) |
static void |
setStalePrevious(@NotNull UpdateOp op,
@NotNull Revision revision,
int height) |
static void |
setSweepRevision(@NotNull UpdateOp op,
@NotNull Revision revision) |
@NotNull Iterable<UpdateOp> |
split(@NotNull RevisionContext context,
@NotNull RevisionVector head,
@NotNull Function<String,Long> binarySize)
Returns update operations to split this document.
|
static void |
unsetCommitRoot(@NotNull UpdateOp op,
@NotNull Revision revision) |
static void |
unsetRevision(@NotNull UpdateOp op,
@NotNull Revision revision) |
boolean |
wasDeletedOnce()
Returns
true if this document was ever deleted in past. |
public static final NodeDocument NULL
public static final String MIN_ID_VALUE
public static final String MAX_ID_VALUE
public static final String COLLISIONS
public static final String MODIFIED_IN_SECS
public static final String DELETED_ONCE
Note that a true value does not mean that node should be considered deleted as it might have been resurrected in later revision. Further note that it might get reset by maintenance tasks once they discover that it indeed was resurrected.
public static final String PATH
public static final String HAS_BINARY_FLAG
public static final String SD_TYPE
NodeDocument.SplitDocType,
Constant Field Valuespublic static final String SD_MAX_REV_TIME_IN_SECS
public static final long HAS_BINARY_VAL
public NodeDocument(@NotNull
@NotNull DocumentStore store,
long creationTime)
store - the document store.creationTime - time at which it was created. Would be different from current time
in case of being resurrected from a serialized forpublic static long getModifiedInSecs(long timestamp)
timestamp - time in millis to convert@NotNull public @NotNull Map<Revision,String> getValueMap(@NotNull @NotNull String key)
Document.get(String) but will always return a value map. The returned value map
may span multiple documents if the values of the given key
were split off to PREVIOUS documents.key - a string key.public long getCreated()
@Nullable public @Nullable Long getModified()
MODIFIED_IN_SECS.null if none is set.public boolean hasChildren()
true if this node possibly has children.
If false then that indicates that there are no childtrue if this node has childrenpublic boolean wasDeletedOnce()
true if this document was ever deleted in past.public boolean hasBeenModifiedSince(long lastModifiedTime)
lastModifiedTime - time to compare against in millistrue if this document was modified after the given
lastModifiedTimepublic boolean hasAllRevisionLessThan(long maxRevisionTime)
maxRevisionTime - timemstamp (in millis) of revision to checktrue if timestamp of maximum revision stored in this document
is less than than the passed revision timestamppublic boolean isSplitDocument()
true if this document is a split documentpublic NodeDocument.SplitDocType getSplitDocType()
public void markUpToDate(long checkTime)
checkTime - time at which the check was performedpublic long getLastCheckTime()
public boolean hasBinary()
@NotNull public @NotNull String getMainPath()
getPath().@NotNull public @NotNull Map<Integer,Revision> getLastRev()
public boolean containsRevision(@NotNull
@NotNull Revision revision)
true if this document contains an entry for the
given revision in the REVISIONS map. Please note
that an entry in the REVISIONS map does not necessarily mean
the the revision is committed.
Use RevisionContext.getCommitValue(Revision, NodeDocument) to get
the commit state of a revision.revision - the revision to check.true if this document contains the given revision.@Nullable public @Nullable String getCommitRootPath(Revision revision)
revision or
null if this document does not have a commit root entry for
the given revision.revision - a revision.null.@Nullable public @Nullable DocumentNodeState getNodeAtRevision(@NotNull @NotNull DocumentNodeStore nodeStore, @NotNull @NotNull RevisionVector readRevision, @Nullable @Nullable Revision lastModified)
DocumentNodeState as seen at the given
readRevision.nodeStore - the node store.readRevision - the read revision.lastModified - the revision when this node was last modified, but
the value is potentially not yet reflected in this
document.
See RevisionContext.getPendingModifications().null if the node doesn't exist at the
given read revision.@Nullable public @Nullable Revision getLiveRevision(RevisionContext context, RevisionVector readRevision, Map<Revision,String> validRevisions, org.apache.jackrabbit.oak.plugins.document.LastRevs lastRevs)
context - the revision contextreadRevision - the read revisionvalidRevisions - the map of revisions to commit value already
checked against readRevision and considered valid.lastRevs - to keep track of the last modification.@NotNull public @NotNull Iterable<UpdateOp> split(@NotNull @NotNull RevisionContext context, @NotNull @NotNull RevisionVector head, @NotNull @NotNull Function<String,Long> binarySize)
RevisionContext. The given head revision must reflect a head
state before doc was retrieved from the document store. This is
important in order to maintain consistency. See OAK-3081 for details.context - the revision context.head - the head revision before this document was retrieved from
the document store.binarySize - a function that returns the binary size of the given
JSON property value String.@NotNull public @NotNull Set<Revision> getLocalBranchCommits()
BRANCH_COMMITS). This method does not consider previous
documents, but only returns the entries on this document.public static void setChildrenFlag(@NotNull
@NotNull UpdateOp op,
boolean hasChildNode)
public static void setModified(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static void setRevision(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision,
@NotNull
@NotNull String commitValue)
public static void unsetRevision(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static boolean isRevisionsEntry(String name)
public static boolean isCommitRootEntry(String name)
public static boolean isDeletedEntry(String name)
public static boolean isLastRevEntry(String name)
public static void removeRevision(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static void addCollision(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision,
@NotNull
@NotNull Revision other)
revision.op - the update operation.revision - the commit for which a collision was detected.other - the revision for the commit, which detected the collision.public static void removeCollision(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static void setLastRev(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static void setCommitRoot(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision,
int commitRootDepth)
public static void removeCommitRoot(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static void unsetCommitRoot(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static void setDeleted(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision,
boolean deleted)
public static void setDeletedOnce(@NotNull
@NotNull UpdateOp op)
public static void removeDeleted(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static void setPrevious(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull org.apache.jackrabbit.oak.plugins.document.Range range)
public static void removePrevious(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull org.apache.jackrabbit.oak.plugins.document.Range range)
public static void removePrevious(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static void setStalePrevious(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision,
int height)
public static void removeStalePrevious(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static void setHasBinary(@NotNull
@NotNull UpdateOp op)
public static void setBranchCommit(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static void removeBranchCommit(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public static void setSweepRevision(@NotNull
@NotNull UpdateOp op,
@NotNull
@NotNull Revision revision)
public String getPath()
public String asString()
public static NodeDocument fromString(DocumentStore store, String s)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.