risingwave_meta/backup_restore/restore_impl/
mod.rs

1// Copyright 2025 RisingWave Labs
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 risingwave_backup::MetaSnapshotId;
16use risingwave_backup::error::BackupResult;
17use risingwave_backup::meta_snapshot::{MetaSnapshot, Metadata};
18
19pub mod v2;
20
21/// `Loader` gets, validates and amends `MetaSnapshot`.
22#[async_trait::async_trait]
23pub trait Loader<S: Metadata> {
24    async fn load(&self, id: MetaSnapshotId) -> BackupResult<MetaSnapshot<S>>;
25}
26
27/// `Writer` writes `MetaSnapshot` to meta store.
28#[async_trait::async_trait]
29pub trait Writer<S: Metadata> {
30    async fn write(&self, s: MetaSnapshot<S>) -> BackupResult<()>;
31    async fn overwrite(
32        &self,
33        new_storage_url: &str,
34        new_storage_dir: &str,
35        new_backup_url: &str,
36        new_backup_dir: &str,
37    ) -> BackupResult<()>;
38}