Skip to main content

LocalDataAccess

Struct LocalDataAccess 

Source
pub struct LocalDataAccess { /* private fields */ }
Expand description

In-process DataAccess backed by the local filesystem, temp directories, and a filesystem-backed artifact store under data_root/.artifacts/.

Construction modes:

  • Self::new — unrestricted paths (tests, ad-hoc tooling).
  • Self::new_for_diff — paths must stay under the two snapshot trees or session workspace (used by the controller).
  • Self::for_plugin — shares the host’s data_root for artifact access, plus a pre-allocated workspace for expansion (C ABI plugins).
  • Self::with_data_root — shares an existing data_root for artifact reads only (no expansion workspace).

Implementations§

Source§

impl LocalDataAccess

Source

pub fn new() -> Self

Source

pub fn new_for_diff(snapshot_a: &Path, snapshot_b: &Path) -> BinocResult<Self>

Session-backed access with path confinement: filesystem reads and register_local targets must lie under the snapshot roots, the session data_root, or a workspace / provide directory created by this instance.

Source

pub fn for_plugin(data_root: PathBuf, workspace: PathBuf) -> Self

Create a LocalDataAccess for a plugin running across the C ABI. Shares the host’s data_root for cache access and uses workspace for expansion (provide, workspace calls).

Source

pub fn with_data_root(data_root: PathBuf) -> Self

Create a LocalDataAccess that can only read from an existing data_root cache. No workspace for expansion. Used during extract-only access.

Trait Implementations§

Source§

impl DataAccess for LocalDataAccess

Source§

fn read_bytes(&self, item: &ItemRef) -> BinocResult<Vec<u8>>

Read the full contents of an item as bytes.
Source§

fn open_read(&self, item: &ItemRef) -> BinocResult<Box<dyn Read + Send>>

Open a streaming reader for an item.
Source§

fn local_path(&self, item: &ItemRef) -> BinocResult<PathBuf>

Get a local filesystem path for tools that require one (e.g. SQLite). Not available on all backends — prefer read_bytes/open_read.
Source§

fn provide(&self, logical_path: &str, content: &[u8]) -> BinocResult<ItemRef>

Make new data available as an item (for container expansion). Returns an ItemRef usable in child ItemPairs.
Source§

fn workspace(&self) -> BinocResult<PathBuf>

Get a fresh writable workspace directory. Managed by the DataAccess — cleaned up when the diff operation completes.
Source§

fn register_local(&self, physical: &Path, logical: &str) -> BinocResult<ItemRef>

Register a local filesystem path as a known item. Returns an ItemRef that can be used in child ItemPairs.
Source§

fn publish_artifact( &self, format: &ArtifactFormat, subject: ArtifactSubject, producer: &str, data: &[u8], ) -> BinocResult<ArtifactDescriptor>

Publish an artifact: store opaque bytes and return a descriptor. Read more
Source§

fn get_artifact( &self, descriptor: &ArtifactDescriptor, ) -> BinocResult<Option<Vec<u8>>>

Retrieve the bytes for a previously published artifact.
Source§

fn data_root(&self) -> BinocResult<PathBuf>

Session-level root directory shared between host and plugins. Artifact files live under <data_root>/.artifacts/. ABI requests carry this path so native plugins can construct a LocalDataAccess that reads from the same artifact store.
Source§

impl Default for LocalDataAccess

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.