1use euphony_compiler::{Entry, Hash};
2use euphony_mix::SpatialSample;
3use std::io;
4
5pub mod fs;
6
7pub trait Storage {
8 type Output: Output;
9 type Reader: io::Read;
10 type Group: Iterator<Item = io::Result<Entry>>;
11 type Sink: Iterator<Item = io::Result<SpatialSample>>;
12
13 fn create(&self) -> Self::Output;
14
15 fn open_raw(&self, hash: &Hash) -> io::Result<Self::Reader>;
16
17 fn open_group(&self, hash: &Hash) -> io::Result<Self::Group>;
18
19 fn open_sink(&self, hash: &Hash) -> io::Result<Self::Sink>;
20}
21
22pub trait Output: 'static + Send + Sync {
23 fn write(&mut self, bytes: &[u8]);
24 fn finish(&mut self) -> Hash;
25}