You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: v1.rs
    path of file: ./repos/risingwave/src/meta/src/backup_restore/restore_impl
    
    the code of the file until where you have to start completion: // Copyright 2024 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use itertools::Itertools;
use risingwave_backup::error::{BackupError, BackupResult};
use risingwave_backup::meta_snapshot::MetaSnapshot;
use risingwave_backup::meta_snapshot_v1::{ClusterMetadata, MetaSnapshotV1};
use risingwave_backup::storage::{MetaSnapshotStorage, MetaSnapshotStorageRef};
use risingwave_backup::MetaSnapshotId;

use crate::backup_restore::restore_impl::{Loader, Writer};
use crate::backup_restore::utils::MetaStoreBackendImpl;
use crate::dispatch_meta_store;
use crate::hummock::model::CompactionGroup;
use crate::manager::model::SystemParamsModel;
use crate::model::{ClusterId, MetadataModel, TableFragments};
use crate::storage::{MetaStore, DEFAULT_COLUMN_FAMILY};

pub struct LoaderV1 {
    backup_store: MetaSnapshotStorageRef,
}

impl LoaderV1 {
    pub fn new(backup_store: MetaSnapshotStorageRef
    
    async fn load(&self, target_id: MetaSnapshotId) -> BackupResult<MetaSnapshot<ClusterMetadata>> {
        let backup_store = &self.backup_store;
        let snapshot_list = &backup_store.manifest().snapshot_metadata;
        let mut target_snapshot: MetaSnapshotV1 = backup_store.get(target_id).await?;
        tracing::info!(
            "snapshot {} before rewrite:\n{}",
            target_id,
            target_snapshot
        );
        let newest_id = snapshot_list
            .iter()
            .map(|m| m.id)
            .max()
            .expect("should exist");
        assert!(
            newest_id >= target_id,
            "newest_id={}, target_id={}",
            newest_id,
            target_id
        );
        // Always use newest snapshot's `default_cf` during restoring, in order not to corrupt shared
        // data of snapshots. Otherwise, for example if we restore a older SST id generator, an
        // existent SST in object store is at risk of being overwrote by the restored cluster.
        // All these risky metadata are in `default_cf`, e.g. id generator, epoch. They must satisfy:
        // - Value is monotonically non-decreasing.
        // - Value is memcomparable.
        // - Keys of newest_snapshot is a superset of that of target_snapshot.
        if newest_id > target_id {
            let newest_snapshot: MetaSnapshotV1 = backup_store.get(newest_id).await?;
            for (k, v) in &target_snapshot.metadata.default_cf {
                let newest_v = newest_snapshot
                    .metadata
                    .default_cf
                    .get(k)
                    .unwrap_or_else(|| panic!("violate superset requirement. key {:x?}", k));
                assert!(newest_v >= v, "violate monotonicity requirement");
            }
            target_snapshot.metadata.default_cf = newest_snapshot.metadata.default_cf;
            tracing::info!(
                "snapshot {} after rewrite by snapshot {}:\n{}",
                target_id,
                newest_id,
                target_snapshot,
            );
        }
        Ok(target_snapshot)
    }