Skip to main content

Crate kernoid_sync

Crate kernoid_sync 

Source
Expand description

kernoid-sync: a folder kept in step with a file store of kernoid (RFC 0005) – the logic every one of kernoid’s apps shares, whatever shows the files (a folder, the system’s file manager through a native shell).

One round (Folder::sync): the store’s changes since the state last read (FileNode/changes; the whole store when there is no state or it is too old), the folder scanned (size and modification time tell a change), both compared with what they were when they last agreed (plan), and the actions carried out. A change on both sides keeps both: the server’s version takes the name, the local one becomes a copy beside it. The local state is a SQLite database outside the folder (state).

Moves are carried over as moves (plan). A download that breaks off goes on where it stopped (an HTTP range); a large upload goes in pieces of 8 MiB joined on the server (Blob/upload, RFC 9404), and one that breaks off goes on with the pieces not sent yet. Vaults (RFC 0006, 6) are kept in step with the account’s key unlocked (Folder::sync_with): names and contents are decrypted here and encrypted before they go; while a vault’s key is not at hand, the vault and what is in it are left as they are on both sides. Names a file system cannot hold – on Windows its reserved names and characters, and where case does not tell names apart a second name that differs only in case – are left out (Names).

OPEN: content hashes to tell a change that keeps size and time; vault contents in pieces (a file there is encrypted in memory, as in the web app); file ids on Windows (moves there are a deletion and a creation).

Modules§

plan
What to do to bring a folder and a store into step – decided from three views of every path: as both sides were when they last agreed (the base), as the store is now, as the folder is now. Pure: no I/O, so every case is tested.
state
The local state of a folder kept in step, in SQLite: the store’s tree as last read with the journal state it belongs to, per path what both sides were when they last agreed (plan::Base), and transfers that broke off. One database per folder; it lives outside the folder, where the app keeps its data. Names in vaults are kept here decrypted, as the folder holds them anyway.

Structs§

Folder
A folder kept in step with one store (an account’s own files, a drive, or files shared with the user).
Names
Which names the folder’s file system can hold.
Report
What a round did.

Enums§

Error

Constants§

PIECE
Files larger than this go up in pieces of this size, each of which can be sent again alone.

Functions§

conflict_copy
report (conflict 2026-10-30 1412).txt beside report.txt – a name not taken yet.
scan
The files and directories of a folder by path; links, unfinished downloads and other kinds are left out.
tree
The store’s nodes by path – without the trash and what is in it, without vaults whose names are not open, and without names the folder cannot hold (they go to skipped, with what is below them).
tree_with
tree with the rules for names of another file system.

Type Aliases§

Result