pub struct LoreBackend { /* private fields */ }Expand description
A VcsBackend implementation backed by the Lore VCS CLI (lore(1)).
LoreBackend requires a remote lore:// URL and a workspace identity
so that it can call lore repository create / lore clone during init.
Use LoreBackend::new() for the default configuration
(reads env-var overrides for the server URL, or falls back to a
local-dev default).
Implementations§
Source§impl LoreBackend
impl LoreBackend
Sourcepub fn from_nap_home(nap_home: &Path) -> Self
pub fn from_nap_home(nap_home: &Path) -> Self
Construct a backend using a specific NAP home rather than whichever
directory happens to be in NAP_DIR.
Sourcepub fn configured_server_url(nap_home: &Path) -> String
pub fn configured_server_url(nap_home: &Path) -> String
Resolve the configured Lore server for a NAP home. This is shared by
remote readers so --base-dir is respected instead of silently
consulting a different NAP_DIR.
Sourcepub fn new(remote_url: &str, workspace_id: &str) -> Self
pub fn new(remote_url: &str, workspace_id: &str) -> Self
Create a new Lore backend.
remote_url should be a lore://host/repository URL.
workspace_id scopes the repository to a multi-tenant workspace.
pub fn remote_url(&self) -> &str
Sourcepub fn clone_repo(url: &str, dest: &Path) -> Result<(), NapError>
pub fn clone_repo(url: &str, dest: &Path) -> Result<(), NapError>
Clone a remote Lore repository to a local path.
Equivalent to lore clone <url> <dest>. Does NOT require an
existing LoreBackend instance — use this when you just want
to clone and don’t need a full backend.
Sourcepub fn clone_repo_with_root_files(
url: &str,
dest: &Path,
root_files: &[String],
) -> Result<(), NapError>
pub fn clone_repo_with_root_files( url: &str, dest: &Path, root_files: &[String], ) -> Result<(), NapError>
Clone only the requested repository-root files and their dependencies. Lore keeps the resulting checkout sparse while still materialising the NAP manifests needed by an entity pull.
Sourcepub fn sync_root_files(
dest: &Path,
root_files: &[String],
) -> Result<(), NapError>
pub fn sync_root_files( dest: &Path, root_files: &[String], ) -> Result<(), NapError>
Synchronize selected root files in an existing Lore working tree.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Convenience constructor that reads configuration from environment variables with sensible local-development defaults.
Precedence: env vars > provider config > defaults
| Env var | Default |
|---|---|
NAP_LORE_URL_BASE | provider-dependent; local uses lore://localhost:41337 |
NAP_WORKSPACE_ID | default |
Note: For new code, prefer using the RepositoryApi with Provider architecture instead of this legacy environment-based constructor.
Sourcepub fn from_provider(url_base: &str, workspace_id: &str) -> Self
pub fn from_provider(url_base: &str, workspace_id: &str) -> Self
Create LoreBackend from provider configuration
This is the preferred constructor for new code using the Provider architecture.
Trait Implementations§
Source§impl Clone for LoreBackend
impl Clone for LoreBackend
Source§fn clone(&self) -> LoreBackend
fn clone(&self) -> LoreBackend
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LoreBackend
impl Debug for LoreBackend
Source§impl VcsBackend for LoreBackend
impl VcsBackend for LoreBackend
Source§fn remote_url_base(&self) -> Result<String, NapError>
fn remote_url_base(&self) -> Result<String, NapError>
Get the remote URL base for constructing repository URLs.
Source§fn init(&self, path: &Path) -> Result<(), NapError>
fn init(&self, path: &Path) -> Result<(), NapError>
Source§fn commit(
&self,
path: &Path,
message: &str,
author: &str,
) -> Result<String, NapError>
fn commit( &self, path: &Path, message: &str, author: &str, ) -> Result<String, NapError>
Source§fn read_file_at_ref(
&self,
repo_path: &Path,
file_path: &str,
reference: Option<&str>,
) -> Result<String, NapError>
fn read_file_at_ref( &self, repo_path: &Path, file_path: &str, reference: Option<&str>, ) -> Result<String, NapError>
reference is None, reads from the current working tree.Source§fn read_file_bytes_at_ref(
&self,
repo_path: &Path,
file_path: &str,
reference: Option<&str>,
) -> Result<Vec<u8>, NapError>
fn read_file_bytes_at_ref( &self, repo_path: &Path, file_path: &str, reference: Option<&str>, ) -> Result<Vec<u8>, NapError>
Source§fn repository_descriptor(
&self,
repo_path: &Path,
) -> Result<VcsRepositoryDescriptor, NapError>
fn repository_descriptor( &self, repo_path: &Path, ) -> Result<VcsRepositoryDescriptor, NapError>
Source§fn http_bearer_token(
&self,
repo_path: &Path,
repository_id: &str,
http_origin: &str,
) -> Result<Option<String>, NapError>
fn http_bearer_token( &self, repo_path: &Path, repository_id: &str, http_origin: &str, ) -> Result<Option<String>, NapError>
Source§fn file_content_address_at_ref(
&self,
repo_path: &Path,
file_path: &str,
reference: &str,
) -> Result<VcsContentAddress, NapError>
fn file_content_address_at_ref( &self, repo_path: &Path, file_path: &str, reference: &str, ) -> Result<VcsContentAddress, NapError>
Source§fn file_metadata_at_ref(
&self,
repo_path: &Path,
file_path: &str,
reference: &str,
) -> Result<Option<BTreeMap<String, String>>, NapError>
fn file_metadata_at_ref( &self, repo_path: &Path, file_path: &str, reference: &str, ) -> Result<Option<BTreeMap<String, String>>, NapError>
Source§fn read_provenance_blob(
&self,
repo_path: &Path,
address: &str,
) -> Result<String, NapError>
fn read_provenance_blob( &self, repo_path: &Path, address: &str, ) -> Result<String, NapError>
Source§fn log(
&self,
path: &Path,
_file: Option<&str>,
limit: usize,
) -> Result<Vec<CommitInfo>, NapError>
fn log( &self, path: &Path, _file: Option<&str>, limit: usize, ) -> Result<Vec<CommitInfo>, NapError>
Source§fn current_branch(&self, path: &Path) -> Result<String, NapError>
fn current_branch(&self, path: &Path) -> Result<String, NapError>
Source§fn revert(&self, path: &Path, commit_hash: &str) -> Result<String, NapError>
fn revert(&self, path: &Path, commit_hash: &str) -> Result<String, NapError>
Source§fn resolve_branch_head(
&self,
path: &Path,
branch: &str,
) -> Result<String, NapError>
fn resolve_branch_head( &self, path: &Path, branch: &str, ) -> Result<String, NapError>
Source§fn add_remote(&self, path: &Path, name: &str, url: &str) -> Result<(), NapError>
fn add_remote(&self, path: &Path, name: &str, url: &str) -> Result<(), NapError>
Source§fn list_remotes(&self, path: &Path) -> Result<Vec<(String, String)>, NapError>
fn list_remotes(&self, path: &Path) -> Result<Vec<(String, String)>, NapError>
(name, url) pairs.Auto Trait Implementations§
impl Freeze for LoreBackend
impl RefUnwindSafe for LoreBackend
impl Send for LoreBackend
impl Sync for LoreBackend
impl Unpin for LoreBackend
impl UnsafeUnpin for LoreBackend
impl UnwindSafe for LoreBackend
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request