uni_common/core/
snapshot.rs1use chrono::{DateTime, Utc};
5use serde::{Deserialize, Serialize};
6use std::collections::HashMap;
7
8#[derive(Clone, Debug, Serialize, Deserialize)]
9pub struct SnapshotManifest {
10 pub snapshot_id: String,
11 pub name: Option<String>,
12 pub created_at: DateTime<Utc>,
13 pub parent_snapshot: Option<String>,
14 pub schema_version: u32,
15 pub version_high_water_mark: u64,
16 pub wal_high_water_mark: u64,
17
18 pub vertices: HashMap<String, LabelSnapshot>,
19 pub edges: HashMap<String, EdgeSnapshot>,
20}
21
22#[derive(Clone, Debug, Serialize, Deserialize)]
28pub struct EntitySnapshot {
29 pub version: u32,
30 pub count: u64,
31 pub lance_version: u64,
32}
33
34pub type LabelSnapshot = EntitySnapshot;
36
37pub type EdgeSnapshot = EntitySnapshot;
39
40impl SnapshotManifest {
41 pub fn new(snapshot_id: String, schema_version: u32) -> Self {
42 Self {
43 snapshot_id,
44 name: None,
45 created_at: Utc::now(),
46 parent_snapshot: None,
47 schema_version,
48 version_high_water_mark: 0,
49 wal_high_water_mark: 0,
50 vertices: HashMap::new(),
51 edges: HashMap::new(),
52 }
53 }
54}