Examples of ApiBuffer


Examples of dovetaildb.api.ApiBuffer

    initialEmptyTxnId = db.commit(prevId, new HashMap<String,ApiBuffer>());
   
    checkEmpty(initialEmptyTxnId);
   
    HashMap<String,ApiBuffer> batch = new HashMap<String,ApiBuffer>();
    ApiBuffer buffer = new ApiBuffer();
    buffer.put("ID1", Util.literalSMap().p("name", "Joe") .p("gender", "m").p("age", 31));
    buffer.put("ID2", Util.literalSMap().p("name", "Jill").p("gender", "f").p("age", 23));
    batch.put("people", buffer);
    twoInsertsTxnId = db.commit(initialEmptyTxnId, batch);
    checkTwoInserts(twoInsertsTxnId);
    checkEmpty(initialEmptyTxnId); // old rev should still appear empty

    batch = new HashMap<String,ApiBuffer>();
    buffer = new ApiBuffer();
    buffer.getDeletions().add("ID1");
    buffer.getDeletions().add("ID2");
    batch.put("people", buffer);
    System.out.println("---------");
    long clearedTxnId = db.commit(twoInsertsTxnId, batch);
    assertEquals(clearedTxnId, initialEmptyTxnId+2);
    checkEmpty(clearedTxnId);
View Full Code Here

Examples of dovetaildb.api.ApiBuffer

    initialEmptyTxnId = db.getHighestCompletedTxnId();
   
    checkEmpty(initialEmptyTxnId);
   
    HashMap<String,ApiBuffer> batch = new HashMap<String,ApiBuffer>();
    ApiBuffer buffer = new ApiBuffer();
    Object loc = m().p("name", "Seattle").p("lat", 34.2).p("lng", 123.1);
    Object txns = l().a(Util.literalMap().p("tot",10295.0)).a(Util.literalMap().p("tot",1995.0));
    Map<String,Object> o1 = m().p("name", "Joe") .p("gender", "m").p("age", 31.0).p("loc",loc).p("txns", txns);
    buffer.put("ID1", o1);
    loc = m().p("name", "New York").p("lat", 22.8).p("lng", 122.8);
    txns = l().a(m().p("tot",6900.0)).a(m().p("tot",623.0));
    Map<String,Object> o2 = m().p("name", "Jill").p("gender", "f").p("age", 23.0).p("loc",loc).p("txns", txns);
    buffer.put("ID2", o2);
    batch.put("people", buffer);
    long commitId = db.commit(initialEmptyTxnId, batch);
   
    List<Object> both = l().a(o1).a(o2);
    List<Object> none = l();
View Full Code Here

Examples of dovetaildb.api.ApiBuffer

    return StdLib.makeMemoryDb();
  }
 
  public void testScoring() {
    HashMap<String,ApiBuffer> batch = new HashMap<String,ApiBuffer>();
    ApiBuffer buffer = new ApiBuffer();
    Object loc;
    loc = m().p("lat", 17.6).p("lng", 122.0);
    Map<String,Object> jane = m().p("name", "Jane").p("age", 30.0).p("gender", "f").p("loc", loc);
    buffer.put("ID2", jane);
    loc = m().p("lat", 22.8).p("lng", 122.8);
    Map<String,Object> phil = m().p("name", "Phil").p("age", 32.0).p("gender", "m").p("loc", loc);
    buffer.put("ID1", phil);
    batch.put("people", buffer);
    long commitId = db.commit(db.getHighestCompletedTxnId(), batch);
   
    List<Object> janeFirst = l().a(jane).a(phil);
    List<Object> philFirst = l().a(phil).a(jane);
View Full Code Here

Examples of dovetaildb.api.ApiBuffer

 
  public void testStaticDataRebuild() throws Exception {
    testAll();
    RebuildingDbService db = (RebuildingDbService)this.db;
    HashMap<String,ApiBuffer> batch = new HashMap<String,ApiBuffer>();
    ApiBuffer buffer = new ApiBuffer();
    buffer.put("ID1", Util.literalSMap().p("name", "Joe") .p("gender", "m").p("age", 31));
    buffer.put("ID2", Util.literalSMap().p("name", "Jill").p("gender", "f").p("age", 23));
    batch.put("people", buffer);
    long lcommit = db.commit(db.getHighestCompletedTxnId(), batch);
    db.rebuildPrimarySegment(1000);
    assertTrue(db.rebuildCatchupIter());
    Iter i = db.query("people", db.getHighestCompletedTxnId(), Util.literalMap(), Util.literalSMap());
View Full Code Here

Examples of dovetaildb.api.ApiBuffer

    // TODO
    throw new RuntimeException();
  }
 
  public ApiBuffer createBufferedData(String bagName) {
    return new ApiBuffer();
  }
View Full Code Here

Examples of dovetaildb.apiservice.ApiBuffer

  public void rollback(long commitId) {
  }
 
  public ApiBuffer createBufferedData(String bagName) {
    return new ApiBuffer();
   
  }
View Full Code Here

Examples of dovetaildb.apiservice.ApiBuffer

   
    checkEmpty(initialEmptyTxnId);
   
    twoInsertsTxnId = 2;
    HashMap<String,ApiBuffer> batch = new HashMap<String,ApiBuffer>();
    ApiBuffer buffer = new ApiBuffer();
    buffer.put("ID1", Util.literalMap().p("name", "Joe") .p("gender", "m").p("age", 31));
    buffer.put("ID2", Util.literalMap().p("name", "Jill").p("gender", "f").p("age", 23));
    batch.put("people", buffer);
//    BufferedData buffer = new BufferedData();
//    buffer.ins(Util.literalMap().p("name", "Joe") .p("gender", "m").p("age", 31));
//    buffer.ins(Util.literalMap().p("name", "Jill").p("gender", "f").p("age", 23));
//    batch.put("people", buffer);
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.