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; }
@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; }
@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; }
@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; }
@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; }
/** * 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; }
@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; }
@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; }
@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; }
@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; }
public DBWrapper(DB db) { _db = db; _measurements = MyMeasurement.getMeasurements( Double.parseDouble( getProperties() .getProperty( Client.EXPECTED_LATENCY_PROPERTY, Client.EXPECTED_LATENCY_PROPERTY_DEFAULT))); }