ic-query 0.25.29

Internet Computer query library for NNS, SNS, ICRC, system canisters, and public network metadata
Documentation
//! Module: sns::report::neurons_cache::paths
//!
//! Responsibility: construct SNS neuron snapshot cache paths.
//! Does not own: cache reads/writes, refresh policy, report construction, or rendering.
//! Boundary: maps SNS root principals to generic snapshot-cache file locations.

use crate::sns::report::cache_paths::{SnsCacheCollection, SnsSnapshotCachePaths};
use std::path::{Path, PathBuf};

pub(super) type SnsNeuronsCachePaths = SnsSnapshotCachePaths<SnsNeuronsCacheCollection>;

///
/// SnsNeuronsCacheCollection
///
/// Collection marker used to derive complete SNS neuron snapshot paths.
///

#[derive(Clone, Debug, Eq, PartialEq)]
pub(super) enum SnsNeuronsCacheCollection {}

impl SnsCacheCollection for SnsNeuronsCacheCollection {
    const COLLECTION: &'static str = "neurons";
}

#[must_use]
pub fn sns_neurons_cache_path(cache_root: &Path, network: &str, root_canister_id: &str) -> PathBuf {
    SnsNeuronsCachePaths::for_root(cache_root, network, root_canister_id).cache_path
}

#[must_use]
pub fn sns_neurons_refresh_lock_path(
    cache_root: &Path,
    network: &str,
    root_canister_id: &str,
) -> PathBuf {
    SnsNeuronsCachePaths::for_root(cache_root, network, root_canister_id).lock_path
}

#[must_use]
pub fn sns_neurons_refresh_attempt_path(
    cache_root: &Path,
    network: &str,
    root_canister_id: &str,
) -> PathBuf {
    SnsNeuronsCachePaths::for_root(cache_root, network, root_canister_id).attempt_path
}