mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-17 05:21:27 +02:00
Adding a blockLocker to the system.
This commit is contained in:
@@ -324,6 +324,17 @@ function Database(){
|
||||
txn.commit();
|
||||
};
|
||||
|
||||
this.lockBlock = function(blockId){
|
||||
let txn = this.env.beginTxn();
|
||||
let blockProto = txn.getBinary(this.blockDB, blockId);
|
||||
if (blockProto !== null){
|
||||
let blockData = global.protos.Block.decode(blockProto);
|
||||
blockData['unlocked'] = false;
|
||||
txn.putBinary(this.blockDB, blockId, global.protos.Block.encode(blockData));
|
||||
}
|
||||
txn.commit();
|
||||
};
|
||||
|
||||
this.getCache = function(cacheKey){
|
||||
debug("Getting Key: "+cacheKey);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user