public class Index
extends java.lang.Object
Provides access to the branch/commit currently checked out. Stores information on dirty objects. Dirty objects are those which have been added or changed before the next commit.
Thread-safety: This class is NOT thread-safe.
MongoDBVDatabase
will hold a thread-local variable to restrict
access to this object.
Constructor and Description |
---|
Index(Commit head,
Tree tree)
Construct a new index.
|
Modifier and Type | Method and Description |
---|---|
void |
clearDirtyObjects()
Clears the map of dirty objects and the map of deleted OIDs
|
boolean |
containsOID(java.lang.String collection,
long oid)
Checks if the index contains an object with the given OID
|
void |
delete(java.lang.String collection,
long uid)
Deletes an object from this index (effectively replaces its OID with
a negative number to mark it as deleted within the commit).
|
IdMap |
find(java.lang.String collection)
Return all objects for a given collection.
|
java.util.Map<java.lang.String,IdSet> |
getDeletedOids() |
java.util.Map<java.lang.String,IdMap> |
getDirtyObjects() |
void |
insert(java.lang.String collection,
long uid,
long oid)
Inserts a new object into the index and marks it as dirty
|
public void insert(java.lang.String collection, long uid, long oid)
collection
- the name of the collection the object has been added touid
- the new object's UIDoid
- the OIDpublic void delete(java.lang.String collection, long uid)
collection
- the name of the collection that contains the objectuid
- the UID of the object to deletepublic IdMap find(java.lang.String collection)
collection
- the collection's namepublic boolean containsOID(java.lang.String collection, long oid)
collection
- the collection that is supposed to contain the objectoid
- the OIDpublic java.util.Map<java.lang.String,IdMap> getDirtyObjects()
public java.util.Map<java.lang.String,IdSet> getDeletedOids()
public void clearDirtyObjects()