Esempio n. 1
0
unique_ref<DirBlobRef> ParallelAccessFsBlobStore::createDirBlob() {
    auto blob = _baseBlobStore->createDirBlob();
    blob->setLstatSizeGetter(_getLstatSize());
    Key key = blob->key();
    return _parallelAccessStore.add<DirBlobRef>(key, std::move(blob), [] (cachingfsblobstore::FsBlobRef *resource) {
        auto dirBlob = dynamic_cast<cachingfsblobstore::DirBlobRef*>(resource);
        ASSERT(dirBlob != nullptr, "Wrong resource given");
        return make_unique_ref<DirBlobRef>(dirBlob);
    });
}
Esempio n. 2
0
optional<unique_ref<FsBlobRef>> ParallelAccessFsBlobStore::load(const Key &key) {
    return _parallelAccessStore.load(key, [this] (cachingfsblobstore::FsBlobRef *blob) {
        cachingfsblobstore::FileBlobRef *fileBlob = dynamic_cast<cachingfsblobstore::FileBlobRef*>(blob);
        if (fileBlob != nullptr) {
            return unique_ref<FsBlobRef>(make_unique_ref<FileBlobRef>(fileBlob));
        }
        cachingfsblobstore::DirBlobRef *dirBlob = dynamic_cast<cachingfsblobstore::DirBlobRef*>(blob);
        if (dirBlob != nullptr) {
            dirBlob->setLstatSizeGetter(_getLstatSize());
            return unique_ref<FsBlobRef>(make_unique_ref<DirBlobRef>(dirBlob));
        }
        cachingfsblobstore::SymlinkBlobRef *symlinkBlob = dynamic_cast<cachingfsblobstore::SymlinkBlobRef*>(blob);
        if (symlinkBlob != nullptr) {
            return unique_ref<FsBlobRef>(make_unique_ref<SymlinkBlobRef>(symlinkBlob));
        }
        ASSERT(false, "Unknown blob type loaded");
    });
}
Esempio n. 3
0
void DirBlob::statChild(const Key &key, struct ::stat *result) const {
  statChildExceptSize(key, result);
  result->st_size = _getLstatSize(key);
}