Weave documentation
Rust referenceweave-agentfs

weave-agentfs · fs

Source declarations, signatures and documentation for fs.

Source: sigil/weave/local/agentfs/src/fs.rs. SHA-256: 5b1c11ce16fb37a7c0115cf785e9e30cd93e75c5f97a8092f476af4b84984254.

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.

fs::AgentFS

AgentFS - Local file system with agent-based ownership

pub struct AgentFS {

}

Source line: 31.

fs::AgentFS::new

Create a new AgentFS instance

pub async fn new(
        root: impl AsRef<Path>,
        config: AgentFSConfig,
        agent_identity: Identity,
        organization_identity: Identity,
        identity_adapter: std::sync::Arc<dyn WeaveIdentityAdapter>,
    ) -> Result<Self>;

Source line: 89.

fs::AgentFS::root

Get the root directory path

pub fn root(&self) -> &Path;

Source line: 155.

fs::AgentFS::agent_identity

Get the managing agent identity

pub fn agent_identity(&self) -> &Identity;

Source line: 160.

fs::AgentFS::organization_identity

Get the organization identity

pub fn organization_identity(&self) -> &Identity;

Source line: 165.

fs::AgentFS::identity_adapter

Get the identity adapter

pub fn identity_adapter(&self) -> &std::sync::Arc<dyn WeaveIdentityAdapter>;

Source line: 170.

fs::AgentFS::set_metadata_schema

Set metadata JSON schema for validation

pub fn set_metadata_schema(&self, schema: &Value) -> Result<()>;

Source line: 175.

fs::AgentFS::put_metadata

Put metadata with optional schema validation

pub async fn put_metadata(&self, path: impl AsRef<Path>, value: Value) -> Result<()>;

Source line: 182.

fs::AgentFS::get_metadata

Get metadata value for a path

pub async fn get_metadata(&self, path: impl AsRef<Path>) -> Result<Option<Value>>;

Source line: 195.

fs::AgentFS::read_file

Read a file

pub async fn read_file(&self, path: impl AsRef<Path>) -> Result<Bytes>;

Source line: 280.

fs::AgentFS::write_file

Write a file

pub async fn write_file(&self, path: impl AsRef<Path>, content: &[u8]) -> Result<()>;

Source line: 306.

fs::AgentFS::mkdir

Create a directory

pub async fn mkdir(&self, path: impl AsRef<Path>, recursive: bool) -> Result<()>;

Source line: 357.

fs::AgentFS::readdir

List directory contents

pub async fn readdir(&self, path: impl AsRef<Path>) -> Result<Vec<String>>;

Source line: 385.

fs::AgentFS::delete

Delete a file or directory

pub async fn delete(&self, path: impl AsRef<Path>) -> Result<()>;

Source line: 423.

fs::AgentFS::exists

Check if path exists

pub async fn exists(&self, path: impl AsRef<Path>) -> Result<bool>;

Source line: 454.

fs::AgentFS::stat

Get file/directory metadata

pub async fn stat(&self, path: impl AsRef<Path>) -> Result<LocalEntry>;

Source line: 461.

Create a symbolic link

pub async fn symlink(&self, path: impl AsRef<Path>, target: impl AsRef<Path>) -> Result<()>;

Source line: 512.

fs::AgentFS::read_file_streamed

Stream read a file with backpressure via provided writer

pub async fn read_file_streamed<W>(&self, path: impl AsRef<Path>, mut writer: W) -> Result<u64>
    where
        W: tokio::io::AsyncWrite + Unpin + Send,;

Source line: 586.

fs::AgentFS::write_file_streamed

Stream write a file with backpressure from provided reader

pub async fn write_file_streamed<R>(&self, path: impl AsRef<Path>, mut reader: R) -> Result<u64>
    where
        R: tokio::io::AsyncRead + Unpin + Send,;

Source line: 616.

fs::AgentFS::readdir_paged

Paged directory listing with ignore patterns

pub async fn readdir_paged(
        &self,
        path: impl AsRef<Path>,
        page: usize,
        page_size: usize,
    ) -> Result<Vec<String>>;

Source line: 653.

fs::AgentFS::metrics

Export simple telemetry metrics

pub fn metrics(&self) -> FsMetrics;

Source line: 669.

fs::AgentFS::fsck_scan

fsck: scan for basic inconsistencies between metadata store and filesystem

pub async fn fsck_scan(&self) -> Result<FsckReport>;

Source line: 680.

fs::AgentFS::sync

Sync with remote Locus (transactional preview/apply)

pub async fn sync(&self, local: &Path, remote: &Path, options: SyncOptions) -> Result<()>;

Source line: 714.

fs::FsMetrics

Simple metrics snapshot for AgentFS

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct FsMetrics {
pub files_read: u64,
pub files_written: u64,
pub dirs_listed: u64,
pub bytes_read: u64,
pub bytes_written: u64
}

Source line: 734.

fs::FsckReport

Basic fsck report

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct FsckReport {
pub missing_entries: Vec<PathBuf>,
pub stale_metadata: Vec<PathBuf>
}

Source line: 744.

On this page