mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
fdb1af8bc9
Summary: Recently the server team added an un-used directory to test that eden would not fetch these as a test for the upcoming repo merge. They saw that these files were fetched a non trivial number of times. We want to know why eden is causing these fetches. This adds the pid and interface through which the client is interacting with eden to ObjectFetchContext for this purpose. This information will be logged in later changes. note: currently this is only for fetches through Fuse (thrift interface to follow). Reviewed By: chadaustin Differential Revision: D22050919 fbshipit-source-id: 49b93257a0e6d910f48b1e8ec6471527e056d22a
42 lines
859 B
C++
42 lines
859 B
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its 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/IObjectStore.h"
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
class LoggingFetchContext : public ObjectFetchContext {
|
|
public:
|
|
struct Request {
|
|
Request(ObjectType t, Hash h, Origin o) : type{t}, hash{h}, origin{o} {}
|
|
|
|
ObjectType type;
|
|
Hash hash;
|
|
Origin origin;
|
|
};
|
|
|
|
void didFetch(ObjectType type, const Hash& hash, Origin origin) override {
|
|
requests.emplace_back(type, hash, origin);
|
|
}
|
|
|
|
std::optional<pid_t> getClientPid() const override {
|
|
return std::nullopt;
|
|
}
|
|
|
|
Cause getCause() const override {
|
|
return Cause::Unknown;
|
|
}
|
|
|
|
std::vector<Request> requests;
|
|
};
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|