Relatude Help

Locks

Every transaction is atomic on its own. A lock is for longer work, such as an editing session, where nobody else may write a node in the meantime. Writes to a locked node are retried and then rejected, unless the transaction carries the lock id:

Guid lockId = db.RequestLock(venue.Id, lockDurationInMs: 30_000);
try {
    var t = new Transaction(db, lockId);   // may write the locked node
    t.Update(venue);
    t.Execute();
    db.RefreshLock(lockId);                // extends the lock during long work
} finally {
    db.ReleaseLock(lockId);
}

A lock expires on its own after its duration, so a crashed client cannot block the database. TryRequestLock returns false instead of throwing when the node is busy. RequestGlobalLock locks the whole store, for maintenance.