pub struct EmbeddedSpiceDB { /* private fields */ }Expand description
Embedded SpiceDB instance (in-memory transport). All RPCs go through the FFI.
For streaming APIs (Watch, ReadRelationships, etc.) use streaming_address
(the C library starts a streaming proxy and returns it in the start response).
Implementations§
Source§impl EmbeddedSpiceDB
impl EmbeddedSpiceDB
Sourcepub fn new(
schema: &str,
relationships: &[Relationship],
options: Option<&StartOptions>,
) -> Result<Self, SpiceDBError>
pub fn new( schema: &str, relationships: &[Relationship], options: Option<&StartOptions>, ) -> Result<Self, SpiceDBError>
Create a new embedded SpiceDB instance with optional schema and relationships.
If schema is non-empty, writes it via SchemaService. If relationships is non-empty, writes them via WriteRelationships.
§Errors
Returns an error if the C library fails to start, returns invalid JSON, or schema/relationship write fails.
Sourcepub const fn permissions(&self) -> MemoryPermissionsClient
pub const fn permissions(&self) -> MemoryPermissionsClient
Permissions service (CheckPermission, WriteRelationships, DeleteRelationships, etc.).
Sourcepub const fn schema(&self) -> MemorySchemaClient
pub const fn schema(&self) -> MemorySchemaClient
Schema service (ReadSchema, WriteSchema).
Sourcepub const fn handle(&self) -> u64
pub const fn handle(&self) -> u64
Raw handle for advanced use (e.g. with spicedb_embedded_sys::memory_transport).
Sourcepub fn streaming_address(&self) -> &str
pub fn streaming_address(&self) -> &str
Returns the address for streaming APIs (Watch, ReadRelationships, LookupResources, LookupSubjects).
Set from the C library start response when the streaming proxy was started.
Sourcepub fn streaming_transport(&self) -> &str
pub fn streaming_transport(&self) -> &str
Streaming proxy transport: “unix” or “tcp” (from C library start response).
Trait Implementations§
Source§impl Drop for EmbeddedSpiceDB
impl Drop for EmbeddedSpiceDB
impl Send for EmbeddedSpiceDB
impl Sync for EmbeddedSpiceDB
Auto Trait Implementations§
impl Freeze for EmbeddedSpiceDB
impl RefUnwindSafe for EmbeddedSpiceDB
impl Unpin for EmbeddedSpiceDB
impl UnsafeUnpin for EmbeddedSpiceDB
impl UnwindSafe for EmbeddedSpiceDB
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> 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> 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