Package de.fhg.igd.mongomvcc

Examples of de.fhg.igd.mongomvcc.VBranch.commit()


   
    // insert another person
    persons.insert(factory.createDocument("name", "Peter"));
   
    // 3. Commit index to the database
    long firstCid = master.commit();
   
    // 4. Read documents from the database
    VCursor c = persons.find();
    for (Map<String, Object> person : c) {
      System.out.print("Person { name: " + person.get("name"));
View Full Code Here


   
    // 5. Make another commit
    persons.insert(factory.createDocument("name", "Max"));
    elvis.put("age", 4);
    persons.insert(elvis);
    master.commit();
   
    // 6. Checkout a previous version
    System.out.println("There are " + persons.find().size() + " persons");
    Map<String, Object> elvis3 = persons.findOne(factory.createDocument("name", "Elvis"));
    System.out.println("Elvis is now " + elvis3.get("age") + " years old");
View Full Code Here

    VBranch maxBranch = _db.createBranch("Max", peterCid);
    VCollection maxPersons = maxBranch.getCollection("persons");
    assertEquals(1, maxPersons.find().size());
   
    maxPersons.insert(_factory.createDocument("name", "Max"));
    long maxCid = maxBranch.commit();
   
    maxBranch = _db.checkout("Max");
    assertEquals(maxCid, maxBranch.getHead());
   
    VBranch peterBranch = _db.checkout(VConstants.MASTER);
View Full Code Here

    VCollection persons2 = master2.getCollection("persons");
    persons2.insert(_factory.createDocument("name", "Elvis"));

    long masterCid = _master.commit();
    try {
      master2.commit();
      fail("We expect a VException here since the branch's head " +
          "could not be updated");
    } catch (VException e) {
      //this is what we expect here
    }
View Full Code Here

    persons2.insert(_factory.createDocument("name", "Pax"));
    long cid3 = master2.commit();
   
    VCollection persons3 = master3.getCollection("persons");
    persons3.insert(_factory.createDocument("name", "Peter"));
    long cid4 = master3.commit();
   
    VBranch master1a = _db.checkout(cid2);
    VCollection persons1a = master1a.getCollection("persons");
    persons1a.insert(_factory.createDocument("name", "Tom"));
    long cid5 = master1a.commit();
View Full Code Here

    long cid4 = master3.commit();
   
    VBranch master1a = _db.checkout(cid2);
    VCollection persons1a = master1a.getCollection("persons");
    persons1a.insert(_factory.createDocument("name", "Tom"));
    long cid5 = master1a.commit();
   
    VBranch master2a = _db.checkout(cid3);
    VCollection persons2a = master2a.getCollection("persons");
    persons2a.insert(_factory.createDocument("name", "Bob"));
    long cid6 = master2a.commit();
View Full Code Here

    long cid5 = master1a.commit();
   
    VBranch master2a = _db.checkout(cid3);
    VCollection persons2a = master2a.getCollection("persons");
    persons2a.insert(_factory.createDocument("name", "Bob"));
    long cid6 = master2a.commit();
   
    VBranch master3a = _db.checkout(cid4);
    VCollection persons3a = master3a.getCollection("persons");
    persons3a.insert(_factory.createDocument("name", "Howard"));
    long cid7 = master3a.commit();
View Full Code Here

    long cid6 = master2a.commit();
   
    VBranch master3a = _db.checkout(cid4);
    VCollection persons3a = master3a.getCollection("persons");
    persons3a.insert(_factory.createDocument("name", "Howard"));
    long cid7 = master3a.commit();
   
    long stime = System.currentTimeMillis();
    Thread.sleep(500);
   
    persons3a.insert(_factory.createDocument("name", "Brenda"));
View Full Code Here

   
    long stime = System.currentTimeMillis();
    Thread.sleep(500);
   
    persons3a.insert(_factory.createDocument("name", "Brenda"));
    long cid8 = master3a.commit();
   
    return new Object[] { new long[] { cid5, cid6, cid7, cid8 }, stime };
  }
 
  /**
 
View Full Code Here

    r[0] = (Long)elvis.get(MongoDBConstants.ID);
   
    VBranch master2 = _db.createBranch("master2", cid1);
    VCollection persons2 = master2.getCollection("persons");
    persons2.insert(_factory.createDocument("name", "Howard"));
    master2.commit();
    Map<String, Object> fritz = _factory.createDocument("name", "Fritz");
    persons2.insert(fritz);
    r[1] = (Long)fritz.get(MongoDBConstants.ID);
   
    long stime = System.currentTimeMillis();
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.