本文整理汇总了C++中FileHelper::GetNextLogSize方法的典型用法代码示例。如果您正苦于以下问题:C++ FileHelper::GetNextLogSize方法的具体用法?C++ FileHelper::GetNextLogSize怎么用?C++ FileHelper::GetNextLogSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHelper
的用法示例。
在下文中一共展示了FileHelper::GetNextLogSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadSnapshotMeta
bool SnapshotControl::LoadSnapshotMeta()
{
// open the snapshot meta file in qfs and read it
// TODO: currently the read/write apis provide a log style file
if (!FileSystemHelper::GetInstance()->IsFileExists(ss_meta_pathname_)) {
LOG4CXX_ERROR(logger_, "Couldn't find snapshot meta: " << ss_meta_.vm_id_ << " " << ss_meta_.snapshot_id_);
return false;
}
FileHelper* fh = FileSystemHelper::GetInstance()->CreateFileHelper(ss_meta_pathname_, O_RDONLY);
fh->Open();
int read_length = fh->GetNextLogSize();
char *data = new char[read_length];
fh->Read(data, read_length);
LOG4CXX_DEBUG(logger_, "Read " << read_length << " from " << ss_meta_pathname_);
stringstream buffer;
buffer.write(data, read_length);
ss_meta_.Deserialize(buffer);
ss_meta_.DeserializeRecipe(buffer);
LOG4CXX_INFO(logger_, "Snapshot meta loaded: " << ss_meta_.vm_id_ << " " << ss_meta_.snapshot_id_);
fh->Close();
FileSystemHelper::GetInstance()->DestroyFileHelper(fh);
delete[] data;
return true;
}
示例2: LoadBloomFilter
bool SnapshotControl::LoadBloomFilter(BloomFilter<Checksum>* pbf, const string& bf_name)
{
if (!FileSystemHelper::GetInstance()->IsFileExists(bf_name)) {
LOG4CXX_ERROR(logger_, "Couldn't find bloom filter: " << bf_name);
return false;
}
FileHelper* fh = FileSystemHelper::GetInstance()->CreateFileHelper(bf_name, O_RDONLY);
fh->Open();
int read_length = fh->GetNextLogSize();
char *data = new char[read_length];
fh->Read(data, read_length);
LOG4CXX_DEBUG(logger_, "Read " << read_length << " from file " << bf_name);
stringstream buffer;
buffer.write(data, read_length);
pbf->Deserialize(buffer);
LOG4CXX_DEBUG(logger_, "Bloom filter loaded: " << bf_name);
fh->Close();
FileSystemHelper::GetInstance()->DestroyFileHelper(fh);
delete[] data;
return true;
}