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’sdata_rootfor artifact access, plus a pre-allocated workspace for expansion (C ABI plugins).Self::with_data_root— shares an existingdata_rootfor artifact reads only (no expansion workspace).
Implementations§
Source§impl LocalDataAccess
impl LocalDataAccess
pub fn new() -> Self
Sourcepub fn new_for_diff(snapshot_a: &Path, snapshot_b: &Path) -> BinocResult<Self>
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.
Sourcepub fn for_plugin(data_root: PathBuf, workspace: PathBuf) -> Self
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).
Sourcepub fn with_data_root(data_root: PathBuf) -> Self
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
impl DataAccess for LocalDataAccess
Source§fn read_bytes(&self, item: &ItemRef) -> BinocResult<Vec<u8>>
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>>
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>
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>
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>
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>
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>
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>>>
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>
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.Auto Trait Implementations§
impl !Freeze for LocalDataAccess
impl RefUnwindSafe for LocalDataAccess
impl Send for LocalDataAccess
impl Sync for LocalDataAccess
impl Unpin for LocalDataAccess
impl UnsafeUnpin for LocalDataAccess
impl UnwindSafe for LocalDataAccess
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
Mutably borrows from an owned value. Read more