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
//! Storage flags: the locks a transaction requests for the keys it writes.
//!
//! These are the throwing forms of
//! [`sys_result::flags`](crate::sys_result::flags), which describes how flags
//! behave. Leaf storage handles expose the same operations through
//! [`Flaggable`](crate::storage::Flaggable).
use crateOrSyscallThrow;
use crateSyscallNo;
use crateflags as result;
use crateStorageKey;
use StorageDeltaFlags;
/// Returns the flags the current transaction requests for `key`, as seen by
/// the current call frame. A key with no pending write has none.
/// Adds `flags` (a bitwise OR) to the flags the current transaction requests
/// for `key`.
///
/// Throws a syscall exception if no write to `key` is pending in the current
/// call frame, or if `flags` holds an unknown flag. See
/// [`sys_result::flags::set_storage_flags`](crate::sys_result::flags::set_storage_flags).
/// Removes every flag the current transaction requests for `key`. Does
/// nothing if no write to `key` is pending.
/// Requests an exclusive lock on `key` after a write to it succeeded, if the
/// write's policy is exclusive; the one place a write policy reaches the host.
/// A shared write adds no syscall.
///
/// The policy is a `bool`, not a flag set, so the only flag this can request
/// is `ExclusiveLock`, and the write just left a pending write in the current
/// frame: the setter cannot fail here. If it fails anyway, this throws, which
/// reverts the frame and the write with it instead of leaving the write in
/// place without its lock. Arbitrary flags go through [`set_storage_flags`],
/// which writes nothing, so a rejected flag set leaves storage unchanged.
pub