moose 0.2.2

Encrypted learning and data processing framework
Documentation
//! Storage traits and implementations.

use crate::computation::*;
use crate::error::{Error, Result};
use async_trait::async_trait;

pub mod filesystem;
pub mod local;

pub trait SyncStorage {
    fn save(&self, key: &str, session_id: &SessionId, val: &Value) -> Result<()>;

    fn load(
        &self,
        key: &str,
        session_id: &SessionId,
        type_hint: Option<Ty>,
        query: &str,
    ) -> Result<Value>;
}

#[async_trait]
pub trait AsyncStorage {
    async fn save(&self, key: &str, session_id: &SessionId, val: &Value) -> Result<()>;

    async fn load(
        &self,
        key: &str,
        session_id: &SessionId,
        type_hint: Option<Ty>,
        query: &str,
    ) -> Result<Value>;
}