当前位置: 首页>>代码示例>>C++>>正文


C++ SharedVolumePtr::listSnapshots方法代码示例

本文整理汇总了C++中SharedVolumePtr::listSnapshots方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedVolumePtr::listSnapshots方法的具体用法?C++ SharedVolumePtr::listSnapshots怎么用?C++ SharedVolumePtr::listSnapshots使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SharedVolumePtr的用法示例。


在下文中一共展示了SharedVolumePtr::listSnapshots方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
api::showSnapshots(const VolumeId& volName,
                   std::list<vd::SnapshotName>& l)
{
    SharedVolumePtr v = VolManager::get()->findVolume_(volName);
    v->listSnapshots(l);
}
开发者ID:openvstorage,项目名称:volumedriver,代码行数:7,代码来源:Api.cpp

示例2: vid

TEST_P(SimpleBackupRestoreTest, rollback_to_previous_snap_if_snapshot_didnt_make_it)
{
    auto ns_ptr = make_random_namespace();

    const backend::Namespace& nspace = ns_ptr->ns();

    // const Namespace nspace;
    const VolumeId vid("backup");


    auto wov = newWriteOnlyVolume(vid,
                                  nspace,
                                  BackupRole::WanBackupBase);
    ASSERT_TRUE(wov);

    const auto cfg(wov->get_config());

    const std::string pattern("a mysteriously returning message");
    const size_t size = 1024 * 1024;
    writeToVolume(*wov, 0, size, pattern);
    const SnapshotName snap("snap");
    wov->createSnapshot(snap);
    waitForThisBackendWrite(*wov);
    const std::string pattern2("a mysteriously disappearing message");
    writeToVolume(*wov, 0, size, pattern2);
    wov->scheduleBackendSync();
    waitForThisBackendWrite(*wov);
    {
        SCOPED_DESTROY_WRITE_ONLY_VOLUME_UNBLOCK_BACKEND_FOR_BACKEND_RESTART(wov, 3);
        wov->createSnapshot(SnapshotName("snap2"));

        const SnapshotPersistor& sp =
            wov->getSnapshotManagement().getSnapshotPersistor();
        SnapshotManagement::writeSnapshotPersistor(sp,
                                                   cm_->newBackendInterface(nspace));
    }

    const fs::path
        cfg_file(make_config_file(nspace,
                                  MaybeString(),
                                  MaybeString(),
                                  MaybeBackupRole(BackupRole::WanBackupNormal)));

    bu::Restore(cfg_file,
                false,
                youtils::GracePeriod(boost::posix_time::seconds(2)))();
    {
        fungi::ScopedLock l(api::getManagementMutex());
        api::backend_restart(nspace,
                             new_owner_tag(),
                             PrefetchVolumeData::T,
                             IgnoreFOCIfUnreachable::T);
    }

    SharedVolumePtr v = getVolume(vid);
    checkVolume(*v, 0, size, pattern);
    std::list<SnapshotName> snaps;
    v->listSnapshots(snaps);
    EXPECT_EQ(1U, snaps.size());
    EXPECT_EQ(snap, snaps.front());
}
开发者ID:bigclouds,项目名称:volumedriver,代码行数:61,代码来源:SimpleBackupRestoreTest.cpp


注:本文中的SharedVolumePtr::listSnapshots方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。