1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- mod serde_blocktree;
- use std::collections::{hash_map, HashMap};
- #[allow(dead_code)]
- enum VersionedBlock {
- V0(Block)
- }
- #[allow(dead_code)]
- struct Block {
- path: String,
- read_caps: HashMap<Hash, ReadCap>,
- write_cap: WriteCap,
- body: Vec<u8>,
- signature: Signature
- }
- #[allow(dead_code)]
- struct ReadCap {
- issued_to: Hash,
- key: EnvelopedKey,
- }
- #[allow(dead_code)]
- struct WriteCap {
- issued_to: Hash,
- path: String,
- chain: Vec<Certificate>,
- signature: Signature,
- }
- #[allow(dead_code)]
- struct Certificate {
- issued_to: Hash,
- issued_by: Hash,
- signature: Signature,
- }
- #[allow(dead_code)]
- enum Hash {
- Sha2_256([u8; 32]),
- Sha2_512([u8; 64]),
- }
- #[allow(dead_code)]
- enum Signature {
- Ed25519([u8; 64]),
- }
- #[allow(dead_code)]
- enum EnvelopedKey {
- Xsalsa20Poly1305([u8; 32]),
- }
- type Directory = HashMap<String, Vec<FragmentRecord>>;
- trait IDirectory {
- fn file_names(&self) -> hash_map::Keys<'_, String, Vec<FragmentRecord>>;
- }
- impl IDirectory for Directory {
- fn file_names(&self) -> hash_map::Keys<'_, String, Vec<FragmentRecord>> {
- self.keys()
- }
- }
- #[allow(dead_code)]
- struct FragmentRecord {
- stored_by: Hash,
- serial: u32,
- }
- #[allow(dead_code)]
- struct Fragment {
- path: String,
- serial: u32,
- body: Vec<u8>,
- }
- fn main() {
- println!("Hello, world!");
- }
|