pub struct GraphPersistence<S>where
S: RawGraphStore,{ /* private fields */ }Expand description
Type-safe wrapper around RawGraphStore that handles TaskGraph serialization.
Consumers in zeph-core use this instead of RawGraphStore directly, so they
never need to deal with JSON strings.
§Storage layout
The task_graphs table stores both metadata columns (goal, status,
created_at, finished_at) and the full graph_json blob. The metadata
columns are summary/index data used for listing and filtering; graph_json
is the authoritative source for full graph reconstruction. On load, only
graph_json is deserialized — the columns are not consulted.
Implementations§
Source§impl<S> GraphPersistence<S>where
S: RawGraphStore,
impl<S> GraphPersistence<S>where
S: RawGraphStore,
Sourcepub fn new(store: S) -> GraphPersistence<S>
pub fn new(store: S) -> GraphPersistence<S>
Create a new GraphPersistence wrapping the given store.
Sourcepub async fn save(&self, graph: &TaskGraph) -> Result<(), OrchestrationError>
pub async fn save(&self, graph: &TaskGraph) -> Result<(), OrchestrationError>
Persist a TaskGraph (upsert).
Returns OrchestrationError::InvalidGraph if graph.goal exceeds
MAX_GOAL_LEN (1024) characters.
§Errors
Returns OrchestrationError::Persistence on serialization or database failure.
Sourcepub async fn load(
&self,
id: &GraphId,
) -> Result<Option<TaskGraph>, OrchestrationError>
pub async fn load( &self, id: &GraphId, ) -> Result<Option<TaskGraph>, OrchestrationError>
Load a TaskGraph by its GraphId.
Returns None if not found.
§Errors
Returns OrchestrationError::Persistence on database or deserialization failure.
Sourcepub async fn list(
&self,
limit: u32,
) -> Result<Vec<GraphSummary>, OrchestrationError>
pub async fn list( &self, limit: u32, ) -> Result<Vec<GraphSummary>, OrchestrationError>
List stored graphs (newest first).
§Errors
Returns OrchestrationError::Persistence on database failure.
Auto Trait Implementations§
impl<S> Freeze for GraphPersistence<S>where
S: Freeze,
impl<S> RefUnwindSafe for GraphPersistence<S>where
S: RefUnwindSafe,
impl<S> Send for GraphPersistence<S>
impl<S> Sync for GraphPersistence<S>
impl<S> Unpin for GraphPersistence<S>where
S: Unpin,
impl<S> UnsafeUnpin for GraphPersistence<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for GraphPersistence<S>where
S: UnwindSafe,
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> 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