Skip to main content

ailake_store/
store.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2use std::ops::Range;
3
4use ailake_core::AilakeResult;
5use async_trait::async_trait;
6use bytes::Bytes;
7
8/// Unified object storage abstraction.
9/// All methods are async; implementations cover local filesystem and cloud (Phase 2).
10#[async_trait]
11pub trait Store: Send + Sync {
12    async fn get(&self, path: &str) -> AilakeResult<Bytes>;
13
14    /// Partial read — critical for S3 HNSW footer reads.
15    async fn get_range(&self, path: &str, range: Range<u64>) -> AilakeResult<Bytes>;
16
17    async fn put(&self, path: &str, data: Bytes) -> AilakeResult<()>;
18
19    async fn list(&self, prefix: &str) -> AilakeResult<Vec<String>>;
20
21    async fn file_size(&self, path: &str) -> AilakeResult<u64>;
22
23    async fn exists(&self, path: &str) -> AilakeResult<bool>;
24
25    async fn delete(&self, path: &str) -> AilakeResult<()>;
26}