nodedb 0.4.0

Local-first, real-time, edge-to-cloud hybrid database for multi-modal workloads
Documentation
// SPDX-License-Identifier: BUSL-1.1

//! The single `ArrayLocalExecutor` trait impl for [`DataPlaneArrayExecutor`].
//!
//! Rust requires every method of a trait impl to live in one block, so this
//! block is the sole point where the trait is satisfied. Each method delegates
//! to the concern-split inherent method (read handlers in [`super::read`], write
//! handlers in [`super::write`]).

use async_trait::async_trait;
use nodedb_cluster::distributed_array::wire::{
    ArrayShardAggReq, ArrayShardDeleteReq, ArrayShardPutReq,
};
use nodedb_cluster::distributed_array::{ArrayAggExec, ArrayLocalExecutor, ArraySliceExec};
use nodedb_cluster::error::Result;

use super::executor::DataPlaneArrayExecutor;

#[async_trait]
impl ArrayLocalExecutor for DataPlaneArrayExecutor {
    async fn exec_slice(
        &self,
        req: &nodedb_cluster::distributed_array::wire::ArrayShardSliceReq,
    ) -> Result<ArraySliceExec> {
        self.slice(req).await
    }

    async fn exec_agg(&self, req: &ArrayShardAggReq) -> Result<ArrayAggExec> {
        self.agg(req).await
    }

    async fn exec_put(&self, req: &ArrayShardPutReq) -> Result<u64> {
        self.put(req).await
    }

    async fn exec_delete(&self, req: &ArrayShardDeleteReq) -> Result<u64> {
        self.delete(req).await
    }

    async fn exec_surrogate_bitmap_scan(
        &self,
        array_id_msgpack: &[u8],
        slice_msgpack: &[u8],
    ) -> Result<Vec<u8>> {
        self.surrogate_bitmap_scan(array_id_msgpack, slice_msgpack)
            .await
    }
}