Skip to main content

dataplane_sdk/core/db/
control_plane.rs

1//  Copyright (c) 2026 Metaform Systems, Inc
2//
3//  This program and the accompanying materials are made available under the
4//  terms of the Apache License, Version 2.0 which is available at
5//  https://www.apache.org/licenses/LICENSE-2.0
6//
7//    SPDX-License-Identifier: Apache-2.0
8//
9//    Contributors:
10//         Metaform Systems, Inc. - initial API and implementation
11//
12
13use crate::core::{error::DbResult, model::control_plane::ControlPlane};
14pub mod memory;
15
16#[cfg(test)]
17use crate::core::db::tx::MockTransaction;
18
19#[async_trait::async_trait]
20#[cfg_attr(test, mockall::automock(type Transaction = MockTransaction;))]
21pub trait ControlPlaneRepo: Send + Sync {
22    type Transaction;
23
24    async fn create(
25        &self,
26        tx: &mut Self::Transaction,
27        control_plane: &ControlPlane,
28    ) -> DbResult<()>;
29
30    async fn fetch_by_id(
31        &self,
32        tx: &mut Self::Transaction,
33        control_plane_id: &str,
34    ) -> DbResult<Option<ControlPlane>>;
35}