1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! Locks: what Cypress gives a transaction to coordinate with.
//!
//! A lock belongs to a transaction and is released when it ends. There is no
//! way to take one without a transaction — the cluster answers `A valid master
//! transaction is required` — so [`Client::lock`](crate::Client::lock) refuses
//! before asking when the client is not in one.
//!
//! Writing to a node takes an exclusive lock on its own; taking one explicitly
//! is for saying *now* rather than later, which is what makes it a coordination
//! primitive rather than an implementation detail.
/// What a lock leaves other transactions able to do.
/// A lock held by a transaction.
///
/// Released when the transaction ends, whichever way it ends. There is no
/// method to drop it here: the lock's lifetime is the transaction's, which is
/// the only thing that makes it safe to hold one across a failure.
///
/// The cluster also answers with a revision, which is `0` for a lock that is
/// still queued and therefore says less than it appears to. It is left out
/// rather than exposed as a number that means two different things.