MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / write

Method write

fendermint/storage/src/im.rs:98–111  ·  view source on GitHub ↗

Take a snapshot to accumulate writes until they are committed. Take a write-lock on the data if necessary, but beware it doesn't work well with STM.

(&self)

Source from the content-addressed store, hash-verified

96 /// Take a snapshot to accumulate writes until they are committed.
97 /// Take a write-lock on the data if necessary, but beware it doesn't work well with STM.
98 fn write(&self) -> Self::Tx<'_> {
99 // Take this lock first, otherwise we might be blocking `data` from anyone being able to commit.
100 let token = if self.lock_writes {
101 Some(self.write_token.lock().unwrap())
102 } else {
103 None
104 };
105 Transaction {
106 backend: self,
107 data: self.data.lock().unwrap().clone(),
108 token,
109 _mode: Write,
110 }
111 }
112}
113
114/// A transaction that can be read-only with no write lock taken,

Callers 5

with_writeMethod · 0.45
check_writableFunction · 0.45
check_write_isolationFunction · 0.45
check_read_isolationFunction · 0.45

Calls

no outgoing calls

Tested by 4

check_writableFunction · 0.36
check_write_isolationFunction · 0.36
check_read_isolationFunction · 0.36