rocketmq_store_api/capability/admin.rs
1// Copyright 2023 The RocketMQ Rust Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use std::future::Future;
16
17use crate::StoreError;
18
19/// Administrative storage capability with implementation-owned values.
20pub trait AdminStore: Send {
21 /// Value type used for request.
22 type Request: Send;
23 /// Value type used for response.
24 type Response: Send;
25
26 /// Executes one bounded administrative operation.
27 ///
28 /// # Errors
29 ///
30 /// Returns [`StoreError`] with [`crate::StoreOperation::Admin`] when the
31 /// administrative operation fails.
32 fn execute_admin(
33 &mut self,
34 request: Self::Request,
35 ) -> impl Future<Output = Result<Self::Response, StoreError>> + Send;
36}