pub struct StorageEngine { /* private fields */ }Expand description
ストレージエンジンのメインエントリポイント
§Example
use kawa_storage::{StorageEngine, StorageConfig};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let config = StorageConfig::default();
let storage = StorageEngine::new(config).await?;
// @todo イベント書き込み・読み取りのサンプル実装
Ok(())
}Implementations§
Source§impl StorageEngine
impl StorageEngine
Sourcepub async fn new(config: StorageConfig) -> StorageResult<Self>
pub async fn new(config: StorageConfig) -> StorageResult<Self>
Sourcepub async fn append_event(
&self,
topic: &Topic,
partition: Partition,
event_data: EventData,
) -> StorageResult<(EventId, Offset)>
pub async fn append_event( &self, topic: &Topic, partition: Partition, event_data: EventData, ) -> StorageResult<(EventId, Offset)>
Sourcepub async fn read_events(
&self,
topic: &Topic,
partition: Partition,
start_offset: Offset,
max_events: usize,
) -> StorageResult<Vec<Event>>
pub async fn read_events( &self, topic: &Topic, partition: Partition, start_offset: Offset, max_events: usize, ) -> StorageResult<Vec<Event>>
Sourcepub async fn get_latest_offset(
&self,
topic: &Topic,
partition: Partition,
) -> StorageResult<Option<Offset>>
pub async fn get_latest_offset( &self, topic: &Topic, partition: Partition, ) -> StorageResult<Option<Offset>>
Sourcepub async fn append_events_batch(
&self,
events: Vec<(Topic, Partition, EventData)>,
) -> StorageResult<Vec<(EventId, Offset)>>
pub async fn append_events_batch( &self, events: Vec<(Topic, Partition, EventData)>, ) -> StorageResult<Vec<(EventId, Offset)>>
Sourcepub fn memory_pool_stats(&self) -> PoolStats
pub fn memory_pool_stats(&self) -> PoolStats
メモリプール統計を取得
Sourcepub async fn shutdown(&self) -> StorageResult<()>
pub async fn shutdown(&self) -> StorageResult<()>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for StorageEngine
impl !RefUnwindSafe for StorageEngine
impl Send for StorageEngine
impl Sync for StorageEngine
impl Unpin for StorageEngine
impl !UnwindSafe for StorageEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more