예제 #1
0
 public int CreateFriendship(int memberA, int memberB) {
   long st = System.nanoTime();
   int res = _db.CreateFriendship(memberA, memberB);
   long en = System.nanoTime();
   _measurements.measure("CREATEFRIENDSHIP", (int) ((en - st) / 1000));
   _measurements.reportReturnCode("CREATEFRIENDSHIP", res);
   return res;
 }
예제 #2
0
 @Override
 public int thawFriendship(int friendid1, int friendid2) {
   // int res=0;
   long st = System.nanoTime();
   int res = _db.thawFriendship(friendid1, friendid2);
   long en = System.nanoTime();
   _measurements.measure("UNFRIEND", (int) ((en - st) / 1000));
   _measurements.reportReturnCode("UNFRIEND", res);
   return res;
 }
예제 #3
0
 @Override
 public int delCommentOnResource(int resourceCreatorID, int resourceID, int manipulationID) {
   // int res=0;
   long st = System.nanoTime();
   int res = _db.delCommentOnResource(resourceCreatorID, resourceID, manipulationID);
   long en = System.nanoTime();
   _measurements.measure("DELCOMMENT", (int) ((en - st) / 1000));
   _measurements.reportReturnCode("DELCOMMENT", res);
   return res;
 }
예제 #4
0
 @Override
 public int inviteFriend(int invitorID, int inviteeID) {
   // int res=0;
   long st = System.nanoTime();
   int res = _db.inviteFriend(invitorID, inviteeID);
   long en = System.nanoTime();
   _measurements.measure("INV", (int) ((en - st) / 1000));
   _measurements.reportReturnCode("INV", res);
   return res;
 }
예제 #5
0
 @Override
 public int viewTopKResources(
     int requesterID, int profileOwnerID, int k, Vector<HashMap<String, ByteIterator>> result) {
   // int res=0;
   long st = System.nanoTime();
   int res = _db.viewTopKResources(requesterID, profileOwnerID, k, result);
   long en = System.nanoTime();
   _measurements.measure("GETTOPRES", (int) ((en - st) / 1000));
   _measurements.reportReturnCode("GETTOPRES", res);
   return res;
 }
예제 #6
0
 /**
  * Insert an entity in the database. Any field/value pairs in the specified values HashMap will be
  * written into the entity with the specified entityPK as its primary key.
  *
  * @param entitySet The name of the entity.
  * @param entityPK The entity primary key of the entity to insert.
  * @param values A HashMap of field/value pairs to insert for the entity.
  * @param insertImage Identifies if images need to be inserted.
  * @return Zero on success, a non-zero error code on error.
  */
 @Override
 public int insertEntity(
     String entitySet,
     String entityPK,
     HashMap<String, ByteIterator> values,
     boolean insertImage) {
   long st = System.nanoTime();
   int res = _db.insertEntity(entitySet, entityPK, values, insertImage);
   long en = System.nanoTime();
   _measurements.measure("INSERT", (int) ((en - st) / 1000));
   _measurements.reportReturnCode("INSERT", res);
   return res;
 }
예제 #7
0
 @Override
 public int postCommentOnResource(
     int commentCreatorID,
     int profileOwnerID,
     int resourceID,
     HashMap<String, ByteIterator> values) {
   // int res=0;
   long st = System.nanoTime();
   int res = _db.postCommentOnResource(commentCreatorID, profileOwnerID, resourceID, values);
   long en = System.nanoTime();
   _measurements.measure("POSTCOMMENT", (int) ((en - st) / 1000));
   _measurements.reportReturnCode("POSTCOMMENT", res);
   return res;
 }
예제 #8
0
 @Override
 public int viewFriendReq(
     int profileOwnerID,
     Vector<HashMap<String, ByteIterator>> values,
     boolean insertImage,
     boolean testMode) {
   // int res=0;
   long st = System.nanoTime();
   int res = _db.viewFriendReq(profileOwnerID, values, insertImage, testMode);
   long en = System.nanoTime();
   _measurements.measure("PENDING", (int) ((en - st) / 1000));
   _measurements.reportReturnCode("PENDING", res);
   return res;
 }
예제 #9
0
 @Override
 public int viewProfile(
     int requesterID,
     int profileOwnerID,
     HashMap<String, ByteIterator> result,
     boolean insertImage,
     boolean testMode) {
   // int res = 0;
   long st = System.nanoTime();
   int res = _db.viewProfile(requesterID, profileOwnerID, result, insertImage, testMode);
   long en = System.nanoTime();
   _measurements.measure("PROFILE", (int) ((en - st) / 1000));
   _measurements.reportReturnCode("PROFILE", res);
   return res;
 }
예제 #10
0
 @Override
 public int listFriends(
     int requesterID,
     int profileOwnerID,
     Set<String> fields,
     Vector<HashMap<String, ByteIterator>> result,
     boolean insertImage,
     boolean testMode) {
   // int res=0;
   long st = System.nanoTime();
   int res = _db.listFriends(requesterID, profileOwnerID, fields, result, insertImage, testMode);
   long en = System.nanoTime();
   _measurements.measure("FRIENDS", (int) ((en - st) / 1000));
   _measurements.reportReturnCode("FRIENDS", res);
   return res;
 }
예제 #11
0
 public DBWrapper(DB db) {
   _db = db;
   _measurements =
       MyMeasurement.getMeasurements(
           Double.parseDouble(
               getProperties()
                   .getProperty(
                       Client.EXPECTED_LATENCY_PROPERTY,
                       Client.EXPECTED_LATENCY_PROPERTY_DEFAULT)));
 }