Skip to main content

Memory

Struct Memory 

Source
struct Memory {
Show 47 fields computer: String, clock: u64, round: u32, seq: u64, own_size: u64, round_base: u64, full_round: u32, grown: u64, continues: u64, owed: bool, owed_waited: i64, owed_last: i64, turns: bool, seal_seen: bool, seal_salt: String, ahead_at: i64, drafts: BTreeMap<String, BTreeSet<String>>, checked: i64, tidied: i64, cleaned: i64, joined: bool, read: BTreeMap<String, (u32, u64)>, read_n: BTreeMap<String, (u32, u64)>, met: BTreeMap<String, (u32, u64)>, waiting_for: BTreeMap<String, Awaited>, broken: BTreeMap<String, i64>, rebuild: BTreeSet<String>, pending: BTreeMap<String, (Option<String>, u64, String)>, entries: BTreeMap<String, Known>, places: BTreeMap<String, String>, emptied: BTreeMap<String, i64>, files: BTreeMap<String, Stat>, traffic: BTreeMap<String, (i64, i64)>, format: u32, switch: bool, floors: BTreeMap<String, Floor>, waiting: BTreeMap<String, (Option<String>, u64, String, u32)>, newer: BTreeMap<String, Newer>, released: BTreeMap<String, u64>, held: BTreeMap<String, (u64, String)>, heard_at: BTreeMap<String, i64>, forgotten: BTreeMap<String, i64>, seen: BTreeMap<String, Entry>, unclocked: BTreeMap<String, i64>, lists: BTreeMap<String, WholeList>, sealed: Sealed, saved: Vec<u8>,
}
Expand description

What this computer remembers between two exchanges (memory.json); what it remembers of files sealed apart aside (files.json, Sealed): a big notes folder makes that long, and what the doses and claims ask (heard, written, traffic) reads the rest alone.

Fields§

§computer: String§clock: u64

The last clock given or read.

§round: u32

This computer’s round (its file) and the records in it.

§seq: u64§own_size: u64

The size of this computer’s file after its last writing: shorter, a sync app put back an older copy of it, and a new one starts (exchange).

§round_base: u64

The size of this computer’s file when its round began: a new round once it grew ROUND_SIZE past it (a round opening on more than that does not start another one each minute).

§full_round: u32

The last round that opens on every entry this computer holds (a full round, new_round); the rounds after it continue it, SEGMENT each at most. 0: kept by an older Sioul, whose every round was full.

§grown: u64

What this computer appended since its last full round (bytes).

§continues: u64

The number of the last line of the round before, when this round continues it (SEGMENT): said on its first line (Turn::p). 0 for a full round.

§owed: bool

A full round is owed: the last round after lost lines of this computer’s (its file cut short) could not restate all it holds (a file not readable then), and a reader that had not read those lines waits for a full round; or another device asks for one (Seen::full). Written as soon as all reads again (new_round).

§owed_waited: i64

How long the full round owed waited for a connection not metered, exchanges running (milliseconds, as Awaited::waited), and the last exchange that counted it: past OWED_METERED, it goes all the same.

§owed_last: i64§turns: bool

This memory enters a round only once the one before was read to its end (Turn). One kept before (10 October 2026) may have moved past the end of a round not read whole: every other computer’s kept rounds are read again once, what was known already changing nothing.

§seal_seen: bool

The folder’s seal was seen here, opening with this device’s key: gone from it later, nothing is written there until it is back (sealed_for).

§seal_salt: String

The salt of that seal: which sharing this memory is of. Another one met (another folder set up with this memory kept): started anew.

§ahead_at: i64

When this device last found its own records in the folder ahead of its memory (milliseconds): again soon after, another device writes under its name (share-twin).

§drafts: BTreeMap<String, BTreeSet<String>>

Every version of each draft met here, by its key: made here, received, or passed over (DRAFTS, sent_meanwhile). Forgotten with the draft’s entry.

§checked: i64

When this computer’s sealed files were last looked for, and the history and leftovers last tidied (milliseconds).

§tidied: i64§cleaned: i64

When what a crash left half written among the folder’s sealed files was last cleaned (milliseconds): once a day, since listing blobs/ reads thousands of names (on a phone, through its storage’s slow layer).

§joined: bool

Others’ records already read in: done once, when sharing starts.

§read: BTreeMap<String, (u32, u64)>

How far each other computer’s records were read: its round and the bytes read in it.

§read_n: BTreeMap<String, (u32, u64)>

The last record read from each other computer: its round and number. Its claims say how far it wrote (lease::Claim::wrote): read that far, everything it said until then is known here (docs/health.md, “Knowing”).

§met: BTreeMap<String, (u32, u64)>

The last line of each other computer met here, read or found damaged (its number then inferred: the one after the line met before): its round and number. A round continuing the one before is entered once that one was met to its last line (Turn), whatever was lost in it, which read_n keeps said for the doses. Missing (a memory kept before 10 October 2026): as read_n.

§waiting_for: BTreeMap<String, Awaited>

Each other computer’s round waiting here for the end of the one before (Turn), and how long it waited, exchanges running: passed over as lost past AWAITED. (awaited, which counted the clock’s time, is left aside.)

§broken: BTreeMap<String, i64>

When a line of another computer’s could not be read here (Unix seconds): what it said is lost.

§rebuild: BTreeSet<String>

Files whose entries are read again from every computer’s records, this one’s too, at the next exchange (rebuild): a record lost here comes back.

§pending: BTreeMap<String, (Option<String>, u64, String)>

Others’ changes not written yet (their file could not be read, or is one this version does not know): tried again at each exchange.

§entries: BTreeMap<String, Known>

Each entry’s last change: its clock, the computer that made it, its value’s hash (“” once taken out).

§places: BTreeMap<String, String>

Where each store was read (its path): a store new here, or moved (another notes folder), joins as a new computer would (exchange).

§emptied: BTreeMap<String, i64>

Files found empty or gone after holding entries, since when (milliseconds): their entries count as taken out only once that has lasted (EMPTIED_WAIT).

§files: BTreeMap<String, Stat>

The files as last read.

§traffic: BTreeMap<String, (i64, i64)>

When each part last sent a change, and last received one here (Unix seconds).

§format: u32

The format this device writes (FORMAT): 0 (an older Sioul’s memory) or 1 until every device in the sharing reads format 2 (format_open), then 2, once and for all (switch_format).

§switch: bool

A record in format 2 met while this device still wrote format 1: another device writes it already; this one does from its next exchange.

§floors: BTreeMap<String, Floor>

Each format-1 entry format 2 renamed: what format 1 last said under it here, by a hash of its name (Floor, floor_key): read again, format 1 at or below it is passed over (translate).

§waiting: BTreeMap<String, (Option<String>, u64, String, u32)>

Others’ changes in a format this device does not write yet (format 2, before its switch) or does not know (a newer Sioul’s): their value, clock, computer and format, written once it can.

§newer: BTreeMap<String, Newer>

Parts met in a format newer than this Sioul knows (Newer). Nothing of them is sent from here, nor written here, until this Sioul is updated, or their writers no longer count (release_newer) (share-newer).

§released: BTreeMap<String, u64>

Parts no longer held for writers that no longer count: their records in that newer format up to this clock, read again, are passed over.

§held: BTreeMap<String, (u64, String)>

Changes found here while their part was held (newer): when they were found (a clock) and what they held (a hash; “” taken out). Once the part is no longer held they go out at that time, not later: a newer device’s later change still wins over them.

§heard_at: BTreeMap<String, i64>

When each other device was last heard of here, from its records read (milliseconds, its clock): what tells a device still there from one gone, with its sealed entry, never its plain notes (present).

§forgotten: BTreeMap<String, i64>

Devices you said are gone (forget_device): when they were last heard of then (milliseconds). They count again once heard of later.

§seen: BTreeMap<String, Entry>

Each other device’s latest sealed entry seen here (note_entries): an older copy put back in the folder never lowers what is known of it.

§unclocked: BTreeMap<String, i64>

The devices known here by records read before (read_n) of which no clock is known at all (their rounds gone from the folder, read by a memory from before heard_at was kept, none of their changes the last word here), with when this device first found them so (milliseconds, its clock): what ages them (present), so that one gone for good stops counting 180 days later.

§lists: BTreeMap<String, WholeList>

What the whole lists of format 1 seen here held (lists format 2 divides), by format 2’s names: each list record read, at its clock, in whatever order (note_whole_record), and, while this device writes format 1, the file between exchanges (note_whole_lists); what a later list took out is passed over at or below that clock (below_whole_floor) and kept with the list’s floor at the switch (Floor::removed).

§sealed: Sealed

What it remembers of files sealed apart, in files.json beside.

§saved: Vec<u8>

memory.json as save last wrote it, kept with the memory in this process (Memory::keep); never written itself.

Implementations§

Source§

impl Memory

Source

fn load(path: &Path, computer: &str) -> Memory

memory.json alone: what the doses and claims ask.

Source

fn load_all(path: &Path, computer: &str) -> Memory

The whole memory, files sealed apart too (files.json), their entries and changes among the others while an exchange runs: as the last exchange in this process left it while both files are as it wrote them (Kept), else read from them.

Source

fn save(&mut self, path: &Path) -> Result<(), String>

Both files written, each when it changed only (a phone’s storage wears), its bytes on the disk before its name changes. The calls’ entries go beside the notes’: a log of lines names each entry by its line, and memory.json, written at every exchange and read by the doses’ knowing, stays small.

Source

fn keep(self, path: &Path)

Kept in this process once saved, for the next exchange or send to take rather than read both files again (Kept).

Source

fn kept(path: &Path, computer: &str) -> Option<Memory>

The memory kept in this process (keep), taken, when it is this computer’s and both its files are still as it wrote them: memory.json the same bytes, files.json the same file (its inode, size and time).

Source

fn tick(&mut self, physical: i64) -> u64

A new clock: after every clock given or read, and not before physical (milliseconds).

Trait Implementations§

Source§

impl Debug for Memory

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Memory

Source§

fn default() -> Memory

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Memory

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Memory

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more