git clone https://garage44.eu/jeroen/pinnacle.git.. /ui/src/fien.rs
//! Fien, the code editor (`programs/src/bin/fien.rs`): what other programs //! and other devices say to it. //! //! Two services. [`SERVICE`] is for this device's programs only (its name //! starts `system-`, which neither installed apps nor other devices reach): //! Files asks it to open a file ([`OPEN`]). [`SHARED`] is what a contact's //! Fien connects to, through the p2p service, when its person shares a text //! to edit together; it reaches this device only if its person offers its //! services to that contact (Settings, Remote access). //! //! On a shared text's channel each message is a kind and its body: //! [`HELLO`] first from the device sharing, then its text's names in //! [`PART`]s ended by [`END`]; then both ways [`OP`] and [`CURSOR`]. /// The service that opens files for this device's programs. pub const SERVICE: &str = "system-fien"; /// The service a contact's Fien edits a shared text through. pub const SHARED: &str = "fien"; /// Open a file (then its path). pub const OPEN: u8 = 1; /// The text's name and the sharer's: a byte's length, the sharer's device /// name, then the file's name. pub const HELLO: u8 = 0x10; /// A piece of the text's names (`fien_core::crdt::Doc::snapshot`). pub const PART: u8 = 0x11; /// The last piece came: the text is whole. pub const END: u8 = 0x12; /// An edit (`fien_core::crdt::Op::encode`). pub const OP: u8 = 0x13; /// Where the sender's cursor is: 0, or 1 and the name of the character /// before it (replica, clock: u32 each, little-endian). pub const CURSOR: u8 = 0x14; /// The most of a snapshot one [`PART`] carries. pub const PART_BYTES: usize = 3000;