pub struct VoidContext {
pub paths: RepoPaths,
pub crypto: CryptoContext,
pub repo: RepoMeta,
pub seal: SealConfig,
pub network: NetworkConfig,
pub user: UserConfig,
}Expand description
Application-level DI container for a single CLI invocation.
Created once (via build_void_context in the CLI crate) and threaded
through the call stack. Subsystems can be borrowed independently.
Fields§
§paths: RepoPathsWhere the repository lives on disk.
crypto: CryptoContextEncryption vault + identity keys.
repo: RepoMetaRepository identity (id, name, secret).
seal: SealConfigCompression / shard sizing settings.
network: NetworkConfigTransport configuration (IPFS, Tor, remotes).
user: UserConfigAuthor identity (name, email).
Implementations§
Source§impl VoidContext
impl VoidContext
Sourcepub fn open_store(&self) -> Result<FsStore>
pub fn open_store(&self) -> Result<FsStore>
Open the object store for this repository.
Sourcepub fn fetch_object<B: EncryptedBlob>(
&self,
remote: &dyn RemoteStore,
cid: &VoidCid,
) -> Result<B>
pub fn fetch_object<B: EncryptedBlob>( &self, remote: &dyn RemoteStore, cid: &VoidCid, ) -> Result<B>
Fetch a typed encrypted blob, local-first with remote fallback.
Checks the local object store first. On miss, fetches raw bytes from the remote (which handles CID verification), stores locally, and wraps.
Sourcepub fn push_object<B: EncryptedBlob>(
&self,
remote: &dyn RemoteStore,
blob: &B,
) -> Result<VoidCid>
pub fn push_object<B: EncryptedBlob>( &self, remote: &dyn RemoteStore, blob: &B, ) -> Result<VoidCid>
Push a typed encrypted blob to a remote store.
Extracts raw bytes, pushes via remote (which handles CID verification).
Sourcepub fn has_identity(&self) -> bool
pub fn has_identity(&self) -> bool
Check if a signing identity is loaded.
Sourcepub fn nostr_pubkey(&self) -> Option<&NostrPubKey>
pub fn nostr_pubkey(&self) -> Option<&NostrPubKey>
Get the nostr public key (if identity was loaded with one).
Sourcepub fn resolve_head(&self) -> Result<Option<CommitCid>>
pub fn resolve_head(&self) -> Result<Option<CommitCid>>
Resolve HEAD to a commit CID (handles workspace-split correctly).
Sourcepub fn decrypt(&self, ciphertext: &[u8], aad: &[u8]) -> Result<Vec<u8>>
pub fn decrypt(&self, ciphertext: &[u8], aad: &[u8]) -> Result<Vec<u8>>
Decrypt a blob using the vault.
Sourcepub fn decrypt_raw(&self, ciphertext: &[u8], aad: &[u8]) -> Result<Vec<u8>>
pub fn decrypt_raw(&self, ciphertext: &[u8], aad: &[u8]) -> Result<Vec<u8>>
Decrypt a blob into raw bytes.
Sourcepub fn open_commit(
&self,
blob: &EncryptedCommit,
) -> Result<(CommitPlaintext, CommitReader)>
pub fn open_commit( &self, blob: &EncryptedCommit, ) -> Result<(CommitPlaintext, CommitReader)>
Decrypt a commit blob and return a CommitReader for child objects.
Sourcepub fn open_and_parse_commit(
&self,
blob: &EncryptedCommit,
) -> Result<(Commit, CommitReader)>
pub fn open_and_parse_commit( &self, blob: &EncryptedCommit, ) -> Result<(Commit, CommitReader)>
Decrypt a commit blob, then parse it into (Commit, CommitReader).
Sourcepub fn load_commit(
&self,
store: &impl ObjectStoreExt,
commit_cid: &VoidCid,
) -> Result<(Commit, CommitReader)>
pub fn load_commit( &self, store: &impl ObjectStoreExt, commit_cid: &VoidCid, ) -> Result<(Commit, CommitReader)>
Load a commit by CID from the store, decrypt, and parse.
Collapses the common store.get → open_with_vault → parse_commit chain
into a single call.
Sourcepub fn load_commit_with_metadata(
&self,
store: &impl ObjectStoreExt,
commit_cid: &VoidCid,
) -> Result<(Commit, MetadataBundle, CommitReader)>
pub fn load_commit_with_metadata( &self, store: &impl ObjectStoreExt, commit_cid: &VoidCid, ) -> Result<(Commit, MetadataBundle, CommitReader)>
Load a commit and its metadata by CID from the store.
Collapses the full store.get → decrypt commit → parse → get metadata → decrypt metadata chain into a single call.
Sourcepub fn load_manifest(
&self,
store: &impl ObjectStoreExt,
commit: &Commit,
reader: &CommitReader,
) -> Result<Option<TreeManifest>>
pub fn load_manifest( &self, store: &impl ObjectStoreExt, commit: &Commit, reader: &CommitReader, ) -> Result<Option<TreeManifest>>
Load a TreeManifest from a commit.
Returns None if the commit has no manifest_cid (older commits).
Sourcepub fn read_file_from_commit(
&self,
store: &impl ObjectStoreExt,
commit: &Commit,
reader: &CommitReader,
ancestor_keys: &[ContentKey],
path: &str,
) -> Result<FileContent>
pub fn read_file_from_commit( &self, store: &impl ObjectStoreExt, commit: &Commit, reader: &CommitReader, ancestor_keys: &[ContentKey], path: &str, ) -> Result<FileContent>
Read a file from a commit using the TreeManifest.
Loads the manifest, looks up the file entry, fetches and decrypts the shard, decompresses the body, and extracts the file content. Handles chunked files (shard_count > 1) by fetching all chunk shards and concatenating their content.
Sourcepub fn decrypt_parse<T>(&self, ciphertext: &[u8], aad: &[u8]) -> Result<T>where
T: DeserializeOwned,
pub fn decrypt_parse<T>(&self, ciphertext: &[u8], aad: &[u8]) -> Result<T>where
T: DeserializeOwned,
Decrypt and parse a CBOR-serialized type.
Source§impl VoidContext
impl VoidContext
Sourcepub fn headless(
void_dir: impl AsRef<Path>,
vault: Arc<KeyVault>,
epoch: u64,
) -> Result<Self>
pub fn headless( void_dir: impl AsRef<Path>, vault: Arc<KeyVault>, epoch: u64, ) -> Result<Self>
Create a context for headless / network-only operations.
Sets root to the parent of void_dir (or void_dir itself if no parent).
Use when no workspace root is available (clone, push, pull, repair, etc.).
Sourcepub fn with_workspace(
root: impl AsRef<Path>,
void_dir: impl AsRef<Path>,
workspace_dir: impl AsRef<Path>,
vault: Arc<KeyVault>,
epoch: u64,
) -> Result<Self>
pub fn with_workspace( root: impl AsRef<Path>, void_dir: impl AsRef<Path>, workspace_dir: impl AsRef<Path>, vault: Arc<KeyVault>, epoch: u64, ) -> Result<Self>
Create a context for a linked worktree.
workspace_dir is the per-workspace state directory (e.g.
.void/worktrees/{name}/) where HEAD, index, staged blobs and
merge state live. Shared state (objects, refs, config, keys)
is still read from void_dir.
Trait Implementations§
Source§impl Clone for VoidContext
impl Clone for VoidContext
Source§fn clone(&self) -> VoidContext
fn clone(&self) -> VoidContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for VoidContext
impl RefUnwindSafe for VoidContext
impl Send for VoidContext
impl Sync for VoidContext
impl Unpin for VoidContext
impl UnsafeUnpin for VoidContext
impl UnwindSafe for VoidContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more