use async_trait::async_trait;
use crate::error::StorageResult;
#[derive(Debug, Clone)]
pub struct PeerNode {
pub id: String,
pub address: Option<String>,
}
#[async_trait]
pub trait Placement: Send + Sync + 'static {
async fn record(&self, key: &str, node_id: &str, size_bytes: i64) -> StorageResult<()>;
async fn remove_all(&self, key: &str) -> StorageResult<()>;
async fn live_holders(&self, key: &str) -> StorageResult<Vec<PeerNode>>;
async fn write_targets(&self, exclude: &[String], count: usize)
-> StorageResult<Vec<PeerNode>>;
async fn size_of(&self, key: &str) -> StorageResult<Option<i64>>;
async fn list_keys(&self, prefix: &str) -> StorageResult<Vec<String>>;
}