Weave documentation
Rust referenceweave-dht

weave-dht · store

Source declarations, signatures and documentation for store.

Source: sigil/weave/network/weave-dht/src/store.rs. SHA-256: 387f71656aef67ee7c801f28fc61f76eec2fa1688803a90386dc009dc93ed19f.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

store::RocksDbRecordStore

RocksDB-backed RecordStore for Kademlia.

Column families:

  • records: key -> value (with 8-byte expiry prefix)
  • providers: key|peer_id -> expiry seconds
  • meta: reserved
#[derive(Clone)]
#[cfg(feature = "rocksdb-store")]
pub struct RocksDbRecordStore {

}

Source line: 66.

store::RocksDbRecordStore::open

#[cfg(feature = "rocksdb-store")]
#[cfg(feature = "rocksdb-store")]
pub fn open(path: &str, peer_id: PeerId) -> anyhow::Result<Self>;

Source line: 84.

store::RocksDbRecordStore::open_with_limits

Open with limits and TTLs

#[cfg(feature = "rocksdb-store")]
#[cfg(feature = "rocksdb-store")]
pub fn open_with_limits(
        path: &str,
        peer_id: PeerId,
        max_bytes: Option<u64>,
        record_ttl_secs: u64,
        provider_ttl_secs: u64,
    ) -> anyhow::Result<Self>;

Source line: 90.

store::RocksDbRecordStore::gc

#[cfg(feature = "rocksdb-store")]
#[cfg(feature = "rocksdb-store")]
pub fn gc(&self);

Source line: 154.

store::RocksDbRecordStore::approx_db_size_bytes

Public: approximate DB size for admin reporting

#[cfg(feature = "rocksdb-store")]
pub fn approx_db_size_bytes(&self) -> Option<u64>;

Source line: 195.

store::RocksDbRecordStore::max_bytes

Public: configured max disk cap if any

#[cfg(feature = "rocksdb-store")]
pub fn max_bytes(&self) -> Option<u64>;

Source line: 206.

store::RocksDbRecordStore::record_ttl_seconds

Public: configured TTLs

#[cfg(feature = "rocksdb-store")]
pub fn record_ttl_seconds(&self) -> u64;

Source line: 210.

store::RocksDbRecordStore::provider_ttl_seconds

#[cfg(feature = "rocksdb-store")]
pub fn provider_ttl_seconds(&self) -> u64;

Source line: 213.

store::RocksDbRecordStore::peer_id

Public: get the peer ID associated with this store

#[cfg(feature = "rocksdb-store")]
pub fn peer_id(&self) -> PeerId;

Source line: 218.

store::DefaultMemoryStore

Fallback type alias used when RocksDB is unavailable or not configured. This is used as a default store when RocksDB is not available.

pub type DefaultMemoryStore = MemoryStore;

Source line: 463.

store::create_rocksdb_store

Create a new RocksDB record store with default settings

#[cfg(feature = "rocksdb-store")]
pub fn create_rocksdb_store(path: &str, peer_id: PeerId) -> anyhow::Result<RocksDbRecordStore>;

Source line: 467.

store::create_rocksdb_store

#[cfg(not(feature = "rocksdb-store"))]
#[allow(dead_code)]
pub fn create_rocksdb_store(_path: &str, _peer_id: PeerId) -> anyhow::Result<DefaultMemoryStore>;

Source line: 472.

store::StoreType

Enum to hold different store types

#[allow(dead_code)]
pub enum StoreType {
    #[cfg(feature = "rocksdb-store")]
    RocksDb(RocksDbRecordStore),
    Memory(DefaultMemoryStore),
}

Source line: 478.

store::create_store_factory

Create a store factory that demonstrates usage of both store types

pub fn create_store_factory() -> impl Fn(&str, PeerId) -> anyhow::Result<StoreType>;

Source line: 485.

On this page