dataplane_sdk/core/db/control_plane/
memory.rs1use crate::core::{
2 db::memory::{MemoryRepo, MemoryTransaction},
3 error::DbResult,
4 model::control_plane::ControlPlane,
5};
6
7use super::ControlPlaneRepo;
8
9#[derive(Default, Clone)]
10pub struct MemoryControlPlaneRepo(MemoryRepo<ControlPlane>);
11
12#[async_trait::async_trait]
13impl ControlPlaneRepo for MemoryControlPlaneRepo {
14 type Transaction = MemoryTransaction;
15
16 async fn create(
17 &self,
18 _tx: &mut Self::Transaction,
19 control_plane: &ControlPlane,
20 ) -> DbResult<()> {
21 self.0.create(&control_plane.id, control_plane).await
22 }
23
24 async fn fetch_by_id(
25 &self,
26 _tx: &mut Self::Transaction,
27 control_plane_id: &str,
28 ) -> DbResult<Option<ControlPlane>> {
29 self.0.fetch_by_id(control_plane_id).await
30 }
31}