chore: bootstrap nana-story M0
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "nana-store"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
nana-domain.workspace = true
|
||||
thiserror.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -0,0 +1,20 @@
|
||||
use nana_domain::{RuntimeState, StoryNode};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum StoreError {
|
||||
#[error("story not found: {0}")]
|
||||
StoryNotFound(String),
|
||||
#[error("storage backend is not initialized")]
|
||||
NotInitialized,
|
||||
}
|
||||
|
||||
pub trait StoryStore: Send + Sync {
|
||||
fn append_node(&self, node: &StoryNode, state: &RuntimeState) -> Result<(), StoreError>;
|
||||
|
||||
fn load_state(
|
||||
&self,
|
||||
story_id: &str,
|
||||
branch_id: &str,
|
||||
) -> Result<RuntimeState, StoreError>;
|
||||
}
|
||||
Reference in New Issue
Block a user