本文整理汇总了C++中IDList::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ IDList::insert方法的具体用法?C++ IDList::insert怎么用?C++ IDList::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDList
的用法示例。
在下文中一共展示了IDList::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Truncate
int CacheBase::Truncate(std::string path, off_t offset)
{
pf_log[W_DEBUG] << "Truncating \"" << path << "\" at " << offset;
pf_stat stat = GetAttr(path);
stat.size = (size_t)offset;
stat.ctime = time(NULL);
stat.mtime = stat.ctime;
stat.meta_mtime = stat.ctime;
IDList idlist;
idlist.insert(environment.my_id.Get());
SetAttr(path, stat, idlist);
FileContent& file = content_list.GetFile(path);
file.Truncate(offset);
return 0;
}
示例2: Write
void CacheBase::Write(std::string path, const char* buf, size_t size, off_t off)
{
FileContent& file = content_list.GetFile(path);
FileChunk chunk(buf, off, size);
file.SetChunk(chunk);
/* No need to lock cache, we don't touch its members */
pf_stat stat = GetAttr(path);
time_t now = time(NULL);
stat.meta_mtime = now;
stat.mtime = now;
stat.ctime = now;
IDList idlist;
idlist.insert(environment.my_id.Get());
if(off + (off_t)size > (off_t)stat.size)
{
stat.size = (size_t)off + size;
SetAttr(path, stat, idlist);
}
//content_list.RefreshPeersRef(path);
}