Examples of IdMap


Examples of de.fhg.igd.mongomvcc.helper.IdMap

   
    //mark dirty objects as inserted
    String instimeAttr = MongoDBConstants.LIFETIME + ".i" + getRootCid();
    for (Map.Entry<String, IdMap> e : dos.entrySet()) {
      DBCollection dbc = db.getCollection(e.getKey());
      IdMap m = e.getValue();
      IdMapIterator li = m.iterator();
      while (li.hasNext()) {
        li.advance();
        long oid = li.value();
        if (oid == -1) {
          //the document has been inserted and then deleted again
View Full Code Here

Examples of de.fhg.igd.mongomvcc.helper.IdMap

    return new Commit(cid, timestamp, parentCID, rootCID, objects);
  }
 
  private static IdMap resolveCollectionObjects(DBObject o) {
    Set<String> keys = o.keySet();
    IdMap r = new IdHashMap(keys.size());
    for (String k : keys) {
      r.put(Long.parseLong(k), (Long)o.get(k));
    }
    return r;
  }
View Full Code Here

Examples of de.fhg.igd.mongomvcc.helper.IdMap

      readCommit(parent, tree);
    }

    //read objects from the given commit and put them into the index
    for (Map.Entry<String, IdMap> e : c.getObjects().entrySet()) {
      IdMap m = getObjects(e.getKey());
      IdSet o = getOIDs(e.getKey());
      IdMapIterator it = e.getValue().iterator();
      while (it.hasNext()) {
        it.advance();
        if (it.value() < 0) {
          //deleted object
          long prev = m.get(it.key());
          if (prev != 0) {
            m.remove(it.key());
            o.remove(prev);
          }
        } else {
          long prev = m.put(it.key(), it.value());
          if (prev != 0) {
            //overwrite object with new value
            o.remove(prev);
          }
          o.add(it.value());
View Full Code Here

Examples of de.fhg.igd.mongomvcc.helper.IdMap

   * the map that maps UIDs to OIDs
   * @param collection the collection's name
   * @return the map
   */
  private IdMap getObjects(String collection) {
    IdMap objs = _objects.get(collection);
    if (objs == null) {
      objs = new IdHashMap();
      _objects.put(collection, objs);
    }
    return objs;
View Full Code Here

Examples of de.fhg.igd.mongomvcc.helper.IdMap

   * the map that maps UIDs of dirty objects to OIDs.
   * @param collection the collection's name
   * @return the map
   */
  private IdMap getDirtyObjects(String collection) {
    IdMap objs = _dirtyObjects.get(collection);
    if (objs == null) {
      objs = new IdHashMap();
      _dirtyObjects.put(collection, objs);
    }
    return objs;
View Full Code Here

Examples of de.fhg.igd.mongomvcc.helper.IdMap

   * @param collection the name of the collection the object has been added to
   * @param uid the new object's UID
   * @param oid the OID
   */
  public void insert(String collection, long uid, long oid) {
    IdMap objs = getObjects(collection);
    IdSet oids = getOIDs(collection);
    long prev = objs.put(uid, oid);
    if (prev != 0) {
      //an existing object is replaced by a new instance. Remove the
      //old OID, since the old object is now invalid (within this index)
      oids.remove(prev);
     
View Full Code Here

Examples of de.fhg.igd.mongomvcc.helper.IdMap

  }
 
  @Override
  public VCursor find() {
    //ask index for OIDs
    IdMap objs = _branch.getIndex().find(_name);
    if (objs.size() == 0) {
      return MongoDBVCursor.EMPTY;
    }

    //ask MongoDB for objects with the given OIDs
    if (objs.size() == 1) {
      //shortcut for one object
      return createCursor(_delegate.find(new BasicDBObject(OID, objs.values()[0])), null);
    } else {
      DBObject qo = new BasicDBObject();
      qo.putAll(_branch.getQueryObject());
      return createCursor(_delegate.find(qo), new OIDInIndexFilter());
    }
View Full Code Here

Examples of de.fhg.igd.mongomvcc.helper.IdMap

    //iterate through all commits and eliminate referenced documents
    DBCollection collCommits = _db.getDB().getCollection(MongoDBConstants.COLLECTION_COMMITS);
    for (DBObject o : collCommits.find()) {
      Commit c = Tree.deserializeCommit(o);
      Map<String, IdMap> allObjs = c.getObjects();
      IdMap objs = allObjs.get(collection);
      if (objs != null) {
        //eliminate OIDs referenced by this commit
        IdMapIterator mi = objs.iterator();
        while (mi.hasNext()) {
          mi.advance();
          oids.remove(mi.value());
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.