本文整理汇总了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);
}
示例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());
}