SHARE
TWEET

Untitled

a guest Jul 17th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function write(key, value, prevEtag) {
  2.   var etag = GUID.NewGuid();
  3.   var record = {
  4.     prevEtag: prevEtag,
  5.     value: value,
  6.     etag: etag
  7.   };
  8.   log(`${DateTime.now()}: writing(${key}, ${record})`);
  9.   db.updateWhen(key, record, x => x.etag == prevEtag);
  10.   log(`${DateTime.now()}: written(${key}, ${record})`);
  11. }
  12.  
  13. function read(key) {
  14.   log(`${DateTime.now()}: reading(${key})`);
  15.   var record = db.read(key);
  16.   log(`${DateTime.now()}: read(${key}, ${record})`);
  17. }
RAW Paste Data
Top