From 130f4f13f51630771112b8f09bf37e2d9e63a049 Mon Sep 17 00:00:00 2001 From: nworbnhoj Date: Fri, 29 Dec 2023 16:50:47 +1100 Subject: [PATCH] sigchat Account doco --- apps/sigchat/src/account.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/sigchat/src/account.rs b/apps/sigchat/src/account.rs index 9988767d6..8df2d9dcb 100644 --- a/apps/sigchat/src/account.rs +++ b/apps/sigchat/src/account.rs @@ -7,6 +7,18 @@ use std::io::{Error, ErrorKind, Read, Write}; use std::str::FromStr; use url::Host; +/// The Account struct is architected as a cache over a pddb dictionary. +/// +/// * Creating a new Account inherently involves writing to pddb +/// * Each field has a 1:1 relationship with a pddb.key. +/// * Field values are able to be set individually +/// +/// Steps to ensure consistency: +/// * the default values in a new Account are first written to pddb, and then read back into the struct. +/// * all fields must be successfully read from pddb or read fails with Error +/// * setting a value requires a successful writes to pddb before updating the field +/// + #[allow(dead_code)] pub struct Account { pddb: Pddb, @@ -64,6 +76,8 @@ impl Account { /// /// # Arguments /// * `pddb_dict` - pddb dictionary name to hold the Account + /// * `host` - Signal host server (immutable) + /// * `service_environment` - Signal service-environment (immutable) /// /// # Returns ///