From d668ce2ff8f308e54c1c7a2c145cb3479cab899d Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 26 Oct 2026 04:13:11 +0100 Subject: move protocol paths to dedicated module --- src/swarm/bootstrap.rs | 5 +++-- src/swarm/members.rs | 5 ++--- src/swarm/peer.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/swarm') diff --git a/src/swarm/bootstrap.rs b/src/swarm/bootstrap.rs index 5e9ac06..ad1de61 100644 --- a/src/swarm/bootstrap.rs +++ b/src/swarm/bootstrap.rs @@ -25,11 +25,12 @@ use tracing::{debug, info, warn}; use uuid::Uuid; use crate::document; +use crate::document::meta::{self, SWARM}; use crate::document::replica::Epoch; use crate::document::store; use crate::files::{FileKind, Files}; use crate::force::Force; -use crate::remake::snapshot::{self, META_ROOT, SWARM}; +use crate::remake::snapshot; use crate::state::AppState; use crate::swarm::peer::{remember_peer, send_hello_once}; @@ -139,7 +140,7 @@ pub(crate) async fn bootstrap(state: &AppState, seeds: &[String], start: Start) } fn swarm_id_path() -> Vec { - vec![META_ROOT.to_owned(), SWARM.to_owned()] + meta::path(&[SWARM]) } /// The swarm ID the document names, if any. diff --git a/src/swarm/members.rs b/src/swarm/members.rs index 9b0de18..cba46f9 100644 --- a/src/swarm/members.rs +++ b/src/swarm/members.rs @@ -20,13 +20,12 @@ use automerge::AutoCommit; use serde_json::{Value as JsonValue, json}; use tracing::{debug, info, warn}; +use crate::document::meta; use crate::document::store::{self, StoreError}; use crate::state::AppState; -const META_ROOT: &str = "_continuum"; - pub(crate) fn members_dir() -> Vec { - vec![META_ROOT.to_owned(), "members".to_owned()] + meta::path(&[meta::MEMBERS]) } pub(crate) fn member_path(pk: &str) -> Vec { diff --git a/src/swarm/peer.rs b/src/swarm/peer.rs index 1240966..651e067 100644 --- a/src/swarm/peer.rs +++ b/src/swarm/peer.rs @@ -11,6 +11,7 @@ use tokio::sync::Mutex; use tokio::time::{Instant, MissedTickBehavior}; use tracing::{debug, info, instrument, trace, warn}; +use crate::document::meta; use crate::document::replica::{Epoch, EpochRelation}; use crate::document::store::{self, StoreError}; use crate::state::{AppState, HelloState, Liveness, PeerState, Standing}; @@ -20,13 +21,12 @@ use crate::transport::{self, ParsedMessage}; const PEER_TICK: Duration = Duration::from_millis(500); -const META_ROOT: &str = "_continuum"; const FORGET_CHECK_INTERVAL: Duration = Duration::from_secs(5); // --- forget records ---------------------------------------------------------- fn forgotten_dir() -> Vec { - vec![META_ROOT.to_owned(), "forgotten".to_owned()] + meta::path(&[meta::FORGOTTEN]) } pub(crate) fn forgotten_path(pk: &str) -> Vec { -- cgit v1.3.1