mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
6f60c48ea8
Summary: Requiring that callers ensure that ObjectFetchContext outlives the asynchronous result is a burden and a memory-safety risk. Without Rust's borrow checker, we can't feel confident this is safe under all error and timeout conditions. It also requires we use folly::collectAll and collectAllSafe, which means that an error during fanout has to wait until the fanout completes before we can report the error to our caller. Moreover, tying the ObjectFetchContext's lifetime to the FUSE/NFS/Thrift/etc. request's lifetime gives us incorrect statistics about how long the request takes. I consider this an API design mistake (on my part). Correct the situation by decoupling ObjectFetchContext from RequestContext, and begin reference-counting ObjectFetchContext. This does increase the number of atomic RMW operations, but we can alleviate those where they matter by manually checking *Future::isReady() before calling .then*. Reviewed By: xavierd Differential Revision: D40744706 fbshipit-source-id: 5baf654f6d65790ed0cafb45c0bc7f2aaa8ecec2
26 lines
615 B
C++
26 lines
615 B
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "eden/fs/store/ObjectFetchContext.h"
|
|
#include "eden/fs/utils/ImmediateFuture.h"
|
|
#include "eden/fs/utils/PathFuncs.h"
|
|
|
|
namespace facebook::eden {
|
|
|
|
class ObjectStore;
|
|
class Tree;
|
|
|
|
ImmediateFuture<std::shared_ptr<const Tree>> resolveTree(
|
|
ObjectStore& objectStore,
|
|
const ObjectFetchContextPtr& fetchContext,
|
|
std::shared_ptr<const Tree> root,
|
|
RelativePathPiece path);
|
|
|
|
} // namespace facebook::eden
|