pub struct Store { /* private fields */ }Expand description
SQLite-backed storage for PlanSpec resources
Implementations§
Source§impl Store
impl Store
Sourcepub async fn new(path: &str) -> Result<Self>
pub async fn new(path: &str) -> Result<Self>
Create a new store, initializing the database schema
Sourcepub async fn create(
&self,
namespace: &str,
kind: &str,
name: &str,
object: Value,
) -> Result<(StoredObject, WatchEvent)>
pub async fn create( &self, namespace: &str, kind: &str, name: &str, object: Value, ) -> Result<(StoredObject, WatchEvent)>
Create a new resource
Sourcepub async fn get(
&self,
namespace: &str,
kind: &str,
name: &str,
) -> Result<Option<StoredObject>>
pub async fn get( &self, namespace: &str, kind: &str, name: &str, ) -> Result<Option<StoredObject>>
Get a resource by key
Sourcepub async fn list(
&self,
namespace: &str,
kind: &str,
) -> Result<Vec<StoredObject>>
pub async fn list( &self, namespace: &str, kind: &str, ) -> Result<Vec<StoredObject>>
List resources by namespace and kind
Sourcepub async fn list_all(&self, kind: &str) -> Result<Vec<StoredObject>>
pub async fn list_all(&self, kind: &str) -> Result<Vec<StoredObject>>
List all resources of a kind across all namespaces
Sourcepub async fn replace(
&self,
namespace: &str,
kind: &str,
name: &str,
object: Value,
expected_resource_version: Option<&str>,
) -> Result<(StoredObject, WatchEvent)>
pub async fn replace( &self, namespace: &str, kind: &str, name: &str, object: Value, expected_resource_version: Option<&str>, ) -> Result<(StoredObject, WatchEvent)>
Replace a resource (with optimistic concurrency check)
Sourcepub async fn delete(
&self,
namespace: &str,
kind: &str,
name: &str,
) -> Result<Option<WatchEvent>>
pub async fn delete( &self, namespace: &str, kind: &str, name: &str, ) -> Result<Option<WatchEvent>>
Delete a resource
Sourcepub async fn create_namespace(&self, name: &str) -> Result<NamespaceInfo>
pub async fn create_namespace(&self, name: &str) -> Result<NamespaceInfo>
Create a namespace (fails if already exists)
Sourcepub async fn ensure_namespace(&self, name: &str) -> Result<NamespaceInfo>
pub async fn ensure_namespace(&self, name: &str) -> Result<NamespaceInfo>
Ensure a namespace exists, creating it if needed (idempotent, race-safe)
Sourcepub async fn get_namespace(&self, name: &str) -> Result<Option<NamespaceInfo>>
pub async fn get_namespace(&self, name: &str) -> Result<Option<NamespaceInfo>>
Get a namespace by name
Sourcepub async fn list_namespaces(&self) -> Result<Vec<NamespaceInfo>>
pub async fn list_namespaces(&self) -> Result<Vec<NamespaceInfo>>
List all namespaces
Sourcepub async fn delete_namespace(&self, name: &str) -> Result<Option<i64>>
pub async fn delete_namespace(&self, name: &str) -> Result<Option<i64>>
Delete a namespace and all its resources (cascade delete)
Sourcepub async fn namespace_exists(&self, name: &str) -> Result<bool>
pub async fn namespace_exists(&self, name: &str) -> Result<bool>
Check if a namespace exists
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Store
impl !RefUnwindSafe for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl !UnwindSafe for Store
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
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>
Converts
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>
Converts
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