Weave documentation
Rust referencedbrowser

dbrowser · commands::files

Source declarations, signatures and documentation for commands::files.

Source: sigil/weave/tools/dbrowser/src-tauri/src/commands/files.rs. SHA-256: c75acc02561045871381dfa04f76934c484ebbf76b1f0215a99da7a96757b76a.

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.

commands::files::FileMetadata

Metadata for a single file (returned by get_file_metadata).

#[derive(Debug, Serialize)]
pub struct FileMetadata {
/// Size in bytes.

pub size: u64,
/// Last modified time as Unix timestamp seconds, if available.

pub modified: Option<u64>,
/// Whether this path is a directory.

pub is_directory: bool
}

Source line: 21.

commands::files::FileVisibility

Visibility policy for a file or directory shared through dBrowser.

#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum FileVisibility {
    /// Local/private by default. Peers should not treat this path as public content.
    Private,
    /// Explicitly pinned as public content.
    Public,
}

Source line: 33.

commands::files::SharePolicyEntry

Persisted public/private policy for one path inside a drive.

#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
pub struct SharePolicyEntry {
/// Drive name.

pub drive: String,
/// Absolute path inside the drive.

pub path: String,
/// Current visibility.

pub visibility: FileVisibility,
/// Whether this path has been explicitly pinned for public discovery.

pub pinned_publicly: bool,
/// Public Locus drive used for explicit pins.

pub public_drive: Option<String>,
/// Public `weave://` URL for this pin.

pub public_url: Option<String>,
/// Last policy update time as Unix timestamp seconds.

pub updated_at: u64
}

Source line: 48.

commands::files::FileEntry

A single file or directory entry.

#[derive(Debug, Serialize)]
pub struct FileEntry {
/// The entry name (file or directory name).

pub name: String,
/// Whether this entry is a directory.

pub is_directory: bool,
/// Size in bytes (0 for directories).

pub size: u64,
/// Last modified time as Unix timestamp seconds, if available.

pub modified: Option<u64>,
/// Detected file type category.

pub file_type: String,
/// Public/private policy.

pub visibility: FileVisibility,
/// Whether this entry has been explicitly pinned for public discovery.

pub pinned_publicly: bool,
/// Public `weave://` URL when this entry is pinned.

pub public_url: Option<String>
}

Source line: 82.

commands::files::SigilStorageNetwork

#[derive(Debug, Clone, Serialize)]
pub struct SigilStorageNetwork {
pub id: String,
pub label: String,
pub chain_id: String,
pub rpc_url: String
}

Source line: 102.

commands::files::SigilStorageProviderRecord

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct SigilStorageProviderRecord {
pub provider_did: String,
pub capacity_gib: u64,
#[serde(default)]
pub regions: Vec<String>,
pub price_per_gib_epoch: u64,
pub retrieval_price_per_gib: u64,
pub replication_guarantee: u16,
pub stake: u64,
#[serde(default)]
pub provider_pubkey: Vec<u8>,
pub status: String,
pub registered_at_height: u64,
pub updated_at_height: u64
}

Source line: 110.

commands::files::SigilStoragePinReceipt

#[derive(Debug, Clone, Serialize)]
pub struct SigilStoragePinReceipt {
pub status: String,
pub scope: String,
pub drive: String,
pub path: String,
pub network_id: String,
pub chain_id: String,
pub rpc_url: String,
pub owner_did: String,
pub request_id: String,
pub weft_root_cid: String,
pub manifest_cid: String,
pub dht_records_published: usize,
pub provider_count: usize,
pub local_receipt_path: String,
pub unsigned_transaction: Value
}

Source line: 127.

commands::files::list_files

List files and directories at a path within a drive.

Uses the Locus drive when available, otherwise falls back to ~/.dbrowser/sites/{drive}/{path} on disk.

#[tauri::command]
pub fn list_files(
    drive: String,
    path: String,
    state: State<'_, AppState>,
) -> Result<Vec<FileEntry>, String>;

Source line: 1258.

commands::files::get_share_policy

Return the explicit or default public/private policy for a path.

#[tauri::command]
pub fn get_share_policy(drive: String, path: String) -> Result<SharePolicyEntry, String>;

Source line: 1276.

commands::files::list_share_policies

Return every explicit share policy entry.

#[tauri::command]
pub fn list_share_policies() -> Result<Vec<SharePolicyEntry>, String>;

Source line: 1282.

commands::files::set_share_policy

Set a path's share policy explicitly.

#[tauri::command]
pub fn set_share_policy(
    drive: String,
    path: String,
    visibility: FileVisibility,
    state: State<'_, AppState>,
) -> Result<SharePolicyEntry, String>;

Source line: 1302.

commands::files::pin_public_file

Mark a path as publicly pinned.

#[tauri::command]
pub fn pin_public_file(
    drive: String,
    path: String,
    state: State<'_, AppState>,
) -> Result<SharePolicyEntry, String>;

Source line: 1315.

commands::files::unpin_public_file

Return a path to private status.

#[tauri::command]
pub fn unpin_public_file(
    drive: String,
    path: String,
    state: State<'_, AppState>,
) -> Result<SharePolicyEntry, String>;

Source line: 1327.

commands::files::list_sigil_storage_providers

Return active Sigil storage providers for the selected network.

#[tauri::command]
pub async fn list_sigil_storage_providers(
    network_id: Option<String>,
    rpc_url: Option<String>,
) -> Result<Vec<SigilStorageProviderRecord>, String>;

Source line: 1339.

commands::files::pin_sigil_storage_file

Stage a file into Weft and prepare an unsigned Sigil StoragePinRequest.

#[allow(clippy::too_many_arguments)]
#[tauri::command]
pub fn pin_sigil_storage_file(
    drive: String,
    path: String,
    network_id: Option<String>,
    rpc_url: Option<String>,
    duration_epochs: u64,
    replication_factor: u16,
    max_price_per_gib_epoch: u64,
    escrowed_amount: u64,
    state: State<'_, AppState>,
) -> Result<SigilStoragePinReceipt, String>;

Source line: 1361.

commands::files::pin_sigil_storage_drive

Stage a deterministic whole-drive snapshot into Weft and prepare a pin request.

#[allow(clippy::too_many_arguments)]
#[tauri::command]
pub fn pin_sigil_storage_drive(
    drive: String,
    network_id: Option<String>,
    rpc_url: Option<String>,
    duration_epochs: u64,
    replication_factor: u16,
    max_price_per_gib_epoch: u64,
    escrowed_amount: u64,
    state: State<'_, AppState>,
) -> Result<SigilStoragePinReceipt, String>;

Source line: 1402.

commands::files::submit_sigil_storage_signed_transaction

Submit a wallet-signed Sigil transaction through the selected network RPC.

#[tauri::command]
pub async fn submit_sigil_storage_signed_transaction(
    network_id: Option<String>,
    rpc_url: Option<String>,
    signed_transaction: Value,
) -> Result<Value, String>;

Source line: 1437.

commands::files::read_file

Read a file from a drive, returning its raw bytes.

Uses the Locus drive when available, otherwise falls back to disk.

#[tauri::command]
pub fn read_file(
    drive: String,
    path: String,
    state: State<'_, AppState>,
) -> Result<Vec<u8>, String>;

Source line: 1450.

commands::files::write_file

Write data to a file in a drive.

Uses the Locus drive when available (with create_parents), otherwise falls back to ~/.dbrowser/sites/{drive}/{path} on disk.

#[tauri::command]
pub fn write_file(
    drive: String,
    path: String,
    data: Vec<u8>,
    state: State<'_, AppState>,
) -> Result<(), String>;

Source line: 1485.

commands::files::share_folder

Share a local folder by indexing its contents into a new private Locus drive and returning its local weave:// URL.

Falls back to copying into ~/.dbrowser/sites/ when the Locus drive cannot be created.

#[tauri::command]
pub fn share_folder(path: String, state: State<'_, AppState>) -> Result<String, String>;

Source line: 1566.

commands::files::create_folder

Create a folder within a drive.

#[tauri::command]
pub fn create_folder(
    drive: String,
    path: String,
    state: State<'_, AppState>,
) -> Result<(), String>;

Source line: 1601.

commands::files::delete_file

Delete a file or directory within a drive.

#[tauri::command]
pub fn delete_file(drive: String, path: String, state: State<'_, AppState>) -> Result<(), String>;

Source line: 1632.

commands::files::rename_file

Rename (move) a file or directory within a drive.

Locus does not expose a native rename operation, so this performs a read-then-write-then-delete sequence for files. For directories the operation is not supported on Locus drives (only on legacy FS).

#[tauri::command]
pub fn rename_file(
    drive: String,
    old_path: String,
    new_path: String,
    state: State<'_, AppState>,
) -> Result<(), String>;

Source line: 1680.

commands::files::get_file_metadata

Get metadata for a specific file or directory within a drive.

#[tauri::command]
pub fn get_file_metadata(
    drive: String,
    path: String,
    state: State<'_, AppState>,
) -> Result<FileMetadata, String>;

Source line: 1737.

commands::files::mount_folder

Mount an external directory as a Locus drive.

  1. Creates a new Locus drive via the WeaveNode.
  2. Recursively indexes the source directory contents into the drive.
  3. Keeps the drive private until a file is explicitly pinned publicly.
  4. Returns the local weave:// URL with the drive name.

Falls back to a filesystem symlink when the Locus drive cannot be created.

#[tauri::command]
pub fn mount_folder(
    source_path: String,
    drive_name: String,
    state: State<'_, AppState>,
) -> Result<String, String>;

Source line: 1789.

On this page