l1fe-weave-core · storage::lens
Source declarations, signatures and documentation for storage::lens.
Reviewed implementation boundary: Some core wrappers derive transport keys from DID strings. Do not infer secret key custody or authenticated peers from a supplied DID string; inspect the chosen wrapper and transport configuration. See /libraries/weave-core/overview.
Source: sigil/weave/libs/weave-core/src/storage/lens.rs. SHA-256: 39be115fc4fa00b066e2a30807c6c4a52dda1e86c69eaa3479259d1c60ecc843.
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.
storage::lens::LensMetadata
Database metadata
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LensMetadata {
/// Database DID
pub did: String,
/// Owner DID
pub owner: Did,
/// Parent database DID (if sub-database)
pub parent: Option<String>,
/// Creation time
pub created_at: DateTime<Utc>,
/// Number of keys
pub key_count: u64
}Source line: 14.
storage::lens::LensEntry
Database entry
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LensEntry {
/// Key
pub key: String,
/// Value (serialized)
pub value: Vec<u8>,
/// Timestamp
pub timestamp: DateTime<Utc>,
/// Version
pub version: u64
}Source line: 29.
storage::lens::LensQuery
Query parameters for range queries
#[derive(Debug, Clone, Default)]
pub struct LensQuery {
/// Start key (inclusive)
pub start: Option<String>,
/// End key (exclusive)
pub end: Option<String>,
/// Maximum number of results
pub limit: Option<usize>,
/// Reverse order
pub reverse: bool
}Source line: 42.
storage::lens::LensDb
Lens database
pub struct LensDb {
}Source line: 54.
storage::lens::Lens
Main Lens interface
pub struct Lens {
}Source line: 66.
storage::lens::Lens::create
Create a new Lens instance
pub fn create(owner: Did, _adapter: Arc<dyn weave_identity::WeaveIdentityAdapter>) -> Self;Source line: 73.
storage::lens::Lens::open
Open an existing Lens instance (read-only by default)
pub fn open(metadata: LensMetadata) -> Self;Source line: 98.
storage::lens::Lens::enable_write_access
Enable write access
pub fn enable_write_access(&mut self);Source line: 110.
storage::lens::Lens::put
Put a key-value pair
pub async fn put(&self, key: &str, value: Vec<u8>) -> Result<()>;Source line: 117.
storage::lens::Lens::get
Get a value by key
pub async fn get(&self, key: &str) -> Result<Option<Vec<u8>>>;Source line: 122.
storage::lens::Lens::delete
Delete a key
pub async fn delete(&self, key: &str) -> Result<bool>;Source line: 127.
storage::lens::Lens::query
Query keys by range
pub async fn query(&self, query: LensQuery) -> Result<Vec<(String, Vec<u8>)>>;Source line: 132.
storage::lens::Lens::sub_db
Get or create a sub-database
pub async fn sub_db(&self, name: &str) -> Result<Arc<LensDb>>;Source line: 137.
storage::lens::Lens::metadata
Get metadata
pub fn metadata(&self) -> LensMetadata;Source line: 142.
storage::lens::LensDb::put_raw
Put a raw key-value pair
pub async fn put_raw(&self, key: &str, value: Vec<u8>) -> Result<()>;Source line: 149.
storage::lens::LensDb::get_raw
Get a raw value by key
pub async fn get_raw(&self, key: &str) -> Result<Option<Vec<u8>>>;Source line: 180.
storage::lens::LensDb::delete
Delete a key
pub async fn delete(&self, key: &str) -> Result<bool>;Source line: 185.
storage::lens::LensDb::query
Query keys by range
pub async fn query(&self, query: LensQuery) -> Result<Vec<(String, Vec<u8>)>>;Source line: 201.
storage::lens::LensDb::sub_db
Get or create a sub-database
pub async fn sub_db(&self, name: &str) -> Result<Arc<LensDb>>;Source line: 236.