Initial Tessera backup vault (M0–M2)
Scaffold Rust workspace, React canvas, vault engine, hub API, providers, agent wormhole path, and Docker compose per SPEC.
This commit is contained in:
27
crates/tessera-store/src/index.rs
Normal file
27
crates/tessera-store/src/index.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
pub struct ChunkIndex {
|
||||
pub chunks: HashMap<String, ChunkEntry>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ChunkEntry {
|
||||
pub pack_id: String,
|
||||
pub offset: u64,
|
||||
pub length: u64,
|
||||
}
|
||||
|
||||
impl ChunkIndex {
|
||||
pub fn record(&mut self, chunk_id: String, pack_id: String, offset: u64, length: u64) {
|
||||
self.chunks.insert(
|
||||
chunk_id,
|
||||
ChunkEntry {
|
||||
pack_id,
|
||||
offset,
|
||||
length,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user