pub struct LoreGrpcClient { /* private fields */ }Expand description
A gRPC client for lore-server’s RevisionService.
This client handles only lightweight metadata operations:
| Operation | RPC | Purpose |
|---|---|---|
get_branch_by_name | BranchGet | Fetch remote branch tip before pull |
push_branch | BranchPush | Advance remote branch tip after push |
Blob transfer (the heavy payload) remains on the lore CLI / HTTP.
Implementations§
Source§impl LoreGrpcClient
impl LoreGrpcClient
Sourcepub fn for_repository_id(&self, id: impl Into<Vec<u8>>) -> Self
pub fn for_repository_id(&self, id: impl Into<Vec<u8>>) -> Self
Return a clone scoped to a repository returned by RepositoryGet.
Sourcepub async fn get_branch_by_name(&self, name: &str) -> Result<Branch, NapError>
pub async fn get_branch_by_name(&self, name: &str) -> Result<Branch, NapError>
Look up a branch by its human-readable name.
Returns the Branch record containing id (binary UUID),
name, latest (tip signature), and other metadata.
pub async fn list_branches(&self) -> Result<Vec<Branch>, NapError>
pub async fn list_revisions( &self, identifier: RevisionIdentifier, ) -> Result<Vec<RevisionItem>, NapError>
Sourcepub async fn push_branch(
&self,
branch_id: Bytes,
revision_signature: Bytes,
force: bool,
) -> Result<(), NapError>
pub async fn push_branch( &self, branch_id: Bytes, revision_signature: Bytes, force: bool, ) -> Result<(), NapError>
Push a revision as the new tip of a branch.
branch_id— binary branch UUID (obtained from [get_branch_by_name]).revision_signature— raw content hash of the revision to set as the new tip.force— iftrue, bypasses fast-forward checks on the server. Whenfalse, the server requires the new tip to descend from the current tip (or performs a fast-forward merge).
Sourcepub fn builder_from_env() -> Result<Option<Self>, NapError>
pub fn builder_from_env() -> Result<Option<Self>, NapError>
Convenience constructor that reads all configuration from environment
variables. Returns Ok(None) when NAP_LORE_GRPC_ENDPOINT is not
set, allowing callers to gracefully skip gRPC integration.
See Builder::from_env for the list of recognised variables.
Sourcepub async fn get_repository_by_name(
&self,
name: &str,
) -> Result<Repository, NapError>
pub async fn get_repository_by_name( &self, name: &str, ) -> Result<Repository, NapError>
Look up a repository before constructing a repository-scoped client.
Sourcepub async fn list_repositories(&self) -> Result<Vec<String>, NapError>
pub async fn list_repositories(&self) -> Result<Vec<String>, NapError>
Return names of repositories visible to the current identity.
Sourcepub async fn read_file_at_revision(
&self,
identifier: RevisionIdentifier,
path: String,
) -> Result<(Vec<u8>, Vec<u8>), NapError>
pub async fn read_file_at_revision( &self, identifier: RevisionIdentifier, path: String, ) -> Result<(Vec<u8>, Vec<u8>), NapError>
Read a single file at a revision tree path. The caller must scope this
client with the repository id returned by RepositoryGet.
Sourcepub async fn read_file_at_signature(
&self,
signature: Vec<u8>,
path: String,
) -> Result<(Vec<u8>, Vec<u8>), NapError>
pub async fn read_file_at_signature( &self, signature: Vec<u8>, path: String, ) -> Result<(Vec<u8>, Vec<u8>), NapError>
Read a file selected by its immutable Lore revision signature.
Sourcepub async fn list_paths_at_revision(
&self,
identifier: RevisionIdentifier,
prefix: String,
) -> Result<Vec<String>, NapError>
pub async fn list_paths_at_revision( &self, identifier: RevisionIdentifier, prefix: String, ) -> Result<Vec<String>, NapError>
List file paths below a revision tree prefix without downloading them.
Sourcepub async fn file_address_at_revision(
&self,
identifier: RevisionIdentifier,
path: String,
) -> Result<(Address, Vec<u8>), NapError>
pub async fn file_address_at_revision( &self, identifier: RevisionIdentifier, path: String, ) -> Result<(Address, Vec<u8>), NapError>
Look up a file’s content address without downloading its payload.
pub async fn revision_info_at_signature( &self, signature: Vec<u8>, ) -> Result<Revision, NapError>
Trait Implementations§
Source§impl Clone for LoreGrpcClient
impl Clone for LoreGrpcClient
Source§fn clone(&self) -> LoreGrpcClient
fn clone(&self) -> LoreGrpcClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for LoreGrpcClient
impl !UnwindSafe for LoreGrpcClient
impl Freeze for LoreGrpcClient
impl Send for LoreGrpcClient
impl Sync for LoreGrpcClient
impl Unpin for LoreGrpcClient
impl UnsafeUnpin for LoreGrpcClient
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