Close state ledger document shape
This commit is contained in:
parent
f19e99c7fe
commit
4cc7e2858d
6 changed files with 2 additions and 16 deletions
|
|
@ -6,7 +6,6 @@ use epiphany_core::add_state_branch;
|
|||
use epiphany_core::append_state_evidence;
|
||||
use epiphany_core::close_state_branch;
|
||||
use epiphany_core::state_ledger_status;
|
||||
use std::collections::BTreeMap;
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
|
@ -29,7 +28,6 @@ fn main() -> Result<()> {
|
|||
status: require_string_arg(&mut args, "--status")?,
|
||||
note: require_string_arg(&mut args, "--note")?,
|
||||
branch: optional_string_arg(&mut args, "--branch")?,
|
||||
extra: BTreeMap::new(),
|
||||
};
|
||||
print_json(&append_state_evidence(store, record)?)?;
|
||||
}
|
||||
|
|
@ -44,7 +42,6 @@ fn main() -> Result<()> {
|
|||
status: "active".to_string(),
|
||||
artifacts,
|
||||
notes: note.unwrap_or_default(),
|
||||
extra: BTreeMap::new(),
|
||||
};
|
||||
print_json(&add_state_branch(store, branch)?)?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ use epiphany_core::add_state_branch;
|
|||
use epiphany_core::append_state_evidence;
|
||||
use epiphany_core::close_state_branch;
|
||||
use epiphany_core::load_state_ledger;
|
||||
use std::collections::BTreeMap;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
|
@ -55,7 +54,6 @@ fn main() -> Result<()> {
|
|||
status: status.context("missing --status")?,
|
||||
note: note.context("missing --note")?,
|
||||
branch,
|
||||
extra: BTreeMap::new(),
|
||||
},
|
||||
)?;
|
||||
println!("Appended evidence record.");
|
||||
|
|
@ -93,7 +91,6 @@ fn main() -> Result<()> {
|
|||
status: "active".to_string(),
|
||||
artifacts,
|
||||
notes: note.unwrap_or_default(),
|
||||
extra: BTreeMap::new(),
|
||||
},
|
||||
)?;
|
||||
println!("Added branch '{id}'.");
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ use cultcache_rs::SingleFileMessagePackBackingStore;
|
|||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::Path;
|
||||
|
||||
pub const STATE_LEDGER_STORE_TYPE: &str = "epiphany.state_ledger";
|
||||
|
|
@ -22,8 +21,6 @@ pub struct EpiphanyStateLedgerEntry {
|
|||
pub branches: Vec<EpiphanyBranchRecord>,
|
||||
#[cultcache(key = 2)]
|
||||
pub evidence: Vec<EpiphanyLedgerEvidenceRecord>,
|
||||
#[cultcache(key = 3, default)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
|
|
@ -33,8 +30,6 @@ pub struct EpiphanyBranchRecord {
|
|||
pub status: String,
|
||||
pub artifacts: Vec<String>,
|
||||
pub notes: String,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
|
|
@ -46,8 +41,6 @@ pub struct EpiphanyLedgerEvidenceRecord {
|
|||
pub note: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub branch: Option<String>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
pub fn state_ledger_status(store_path: impl AsRef<Path>) -> Result<Value> {
|
||||
|
|
@ -178,7 +171,6 @@ fn default_state_ledger() -> EpiphanyStateLedgerEntry {
|
|||
schema_version: STATE_LEDGER_SCHEMA_VERSION.to_string(),
|
||||
branches: Vec::new(),
|
||||
evidence: Vec::new(),
|
||||
extra: BTreeMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -228,7 +220,6 @@ mod tests {
|
|||
status: "active".to_string(),
|
||||
artifacts: vec!["state/map.yaml".to_string()],
|
||||
notes: "test".to_string(),
|
||||
extra: BTreeMap::new(),
|
||||
},
|
||||
)?;
|
||||
let entry = load_state_ledger(&store)?;
|
||||
|
|
@ -242,7 +233,6 @@ mod tests {
|
|||
status: "ok".to_string(),
|
||||
note: "Native evidence append works.".to_string(),
|
||||
branch: Some("main".to_string()),
|
||||
extra: BTreeMap::new(),
|
||||
},
|
||||
)?;
|
||||
assert_eq!(load_state_ledger(&store)?.evidence.len(), 1);
|
||||
|
|
|
|||
Reference in a new issue