pub struct DocumentServiceWrapper { /* private fields */ }Expand description
Thread-safe, Clone-able FFI wrapper for the unified Document API.
All methods accept JSON strings and return JSON strings, making them suitable for consumption from Python, Node.js, Go, and other FFI callers.
Implementations§
Source§impl DocumentServiceWrapper
impl DocumentServiceWrapper
Sourcepub fn new(service: Box<dyn DocumentService>) -> Self
pub fn new(service: Box<dyn DocumentService>) -> Self
Create a wrapper from a boxed DocumentService.
Sourcepub fn from_arc(service: Arc<dyn DocumentService>) -> Self
pub fn from_arc(service: Arc<dyn DocumentService>) -> Self
Create a wrapper from an Arc<dyn DocumentService>.
Sourcepub fn from_agent_wrapper(wrapper: &AgentWrapper) -> BindingResult<Self>
pub fn from_agent_wrapper(wrapper: &AgentWrapper) -> BindingResult<Self>
Create a wrapper from an AgentWrapper using the filesystem backend.
This is the typical construction path for language bindings: load an agent, then create a document service from it.
Sourcepub fn create_json(
&self,
json: &str,
options_json: Option<&str>,
) -> BindingResult<String>
pub fn create_json( &self, json: &str, options_json: Option<&str>, ) -> BindingResult<String>
Create a new document. Returns the signed document as JSON.
options_json is an optional JSON string of CreateOptions.
If None, defaults are used.
Sourcepub fn get_json(&self, key: &str) -> BindingResult<String>
pub fn get_json(&self, key: &str) -> BindingResult<String>
Get a document by key (id:version). Returns the document JSON.
Sourcepub fn get_latest_json(&self, document_id: &str) -> BindingResult<String>
pub fn get_latest_json(&self, document_id: &str) -> BindingResult<String>
Get the latest version of a document. Returns the document JSON.
Sourcepub fn update_json(
&self,
document_id: &str,
new_json: &str,
options_json: Option<&str>,
) -> BindingResult<String>
pub fn update_json( &self, document_id: &str, new_json: &str, options_json: Option<&str>, ) -> BindingResult<String>
Update a document, creating a new signed version. Returns the new version JSON.
options_json is an optional JSON string of UpdateOptions.
Sourcepub fn remove_json(&self, key: &str) -> BindingResult<String>
pub fn remove_json(&self, key: &str) -> BindingResult<String>
Remove (tombstone) a document. Returns the tombstoned document JSON.
Sourcepub fn list_json(&self, filter_json: Option<&str>) -> BindingResult<String>
pub fn list_json(&self, filter_json: Option<&str>) -> BindingResult<String>
List documents with optional filter. Returns JSON array of DocumentSummary.
filter_json is an optional JSON string of ListFilter.
Sourcepub fn search_json(&self, query_json: &str) -> BindingResult<String>
pub fn search_json(&self, query_json: &str) -> BindingResult<String>
Search documents. Returns JSON SearchResults.
query_json is a JSON string of SearchQuery.
Sourcepub fn versions_json(&self, document_id: &str) -> BindingResult<String>
pub fn versions_json(&self, document_id: &str) -> BindingResult<String>
Get all versions of a document. Returns JSON array of documents.
Sourcepub fn diff_json(&self, key_a: &str, key_b: &str) -> BindingResult<String>
pub fn diff_json(&self, key_a: &str, key_b: &str) -> BindingResult<String>
Diff two document versions. Returns JSON DocumentDiff.
Sourcepub fn visibility_json(&self, key: &str) -> BindingResult<String>
pub fn visibility_json(&self, key: &str) -> BindingResult<String>
Get the visibility of a document. Returns JSON string ("public", "private", etc.).
Sourcepub fn set_visibility_json(
&self,
key: &str,
visibility_json: &str,
) -> BindingResult<()>
pub fn set_visibility_json( &self, key: &str, visibility_json: &str, ) -> BindingResult<()>
Set the visibility of a document.
visibility_json is a JSON string (e.g., "public", "private",
{"restricted":["agent-a"]}).
Trait Implementations§
Source§impl Clone for DocumentServiceWrapper
impl Clone for DocumentServiceWrapper
Source§fn clone(&self) -> DocumentServiceWrapper
fn clone(&self) -> DocumentServiceWrapper
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DocumentServiceWrapper
impl !RefUnwindSafe for DocumentServiceWrapper
impl Send for DocumentServiceWrapper
impl Sync for DocumentServiceWrapper
impl Unpin for DocumentServiceWrapper
impl UnsafeUnpin for DocumentServiceWrapper
impl !UnwindSafe for DocumentServiceWrapper
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
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 more