add playout service: HLS streaming, FFmpeg, SegmentStore port (#9)
This commit is contained in:
28
crates/playout/src/segment_store/mod.rs
Normal file
28
crates/playout/src/segment_store/mod.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
pub mod filesystem;
|
||||
pub mod memory;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use bytes::Bytes;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SegmentStoreError {
|
||||
#[error("segment not found: {0}")]
|
||||
NotFound(String),
|
||||
#[error("io error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
}
|
||||
|
||||
pub type SegmentStoreResult<T> = Result<T, SegmentStoreError>;
|
||||
|
||||
#[async_trait]
|
||||
pub trait SegmentStore: Send + Sync {
|
||||
async fn write_segment(&self, channel_id: &str, name: &str, data: Bytes)
|
||||
-> SegmentStoreResult<()>;
|
||||
|
||||
async fn read_segment(&self, channel_id: &str, name: &str) -> SegmentStoreResult<Bytes>;
|
||||
|
||||
async fn list_segments(&self, channel_id: &str) -> SegmentStoreResult<Vec<String>>;
|
||||
|
||||
async fn delete_segment(&self, channel_id: &str, name: &str) -> SegmentStoreResult<()>;
|
||||
}
|
||||
Reference in New Issue
Block a user