mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
75a5678622
Summary: Naming the concept allows us to decouple implementation details and imagine future implementations. Reviewed By: kmancini Differential Revision: D45917739 fbshipit-source-id: d0d0a023c2d978c8a509af0e7187295b4c9c413b
51 lines
1.3 KiB
C++
51 lines
1.3 KiB
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 <folly/futures/Future.h>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace facebook::eden {
|
|
|
|
class UsageService {
|
|
public:
|
|
virtual ~UsageService() = default;
|
|
|
|
/**
|
|
* Queries a predictive service for the top N directories given a user and
|
|
* repo name.
|
|
*
|
|
* Used for the predictiveGlobFiles Thrift method.
|
|
*/
|
|
virtual folly::SemiFuture<std::vector<std::string>> getTopUsedDirs(
|
|
std::string_view user,
|
|
std::string_view repo,
|
|
uint32_t numResults,
|
|
std::optional<std::string_view> os,
|
|
std::optional<uint64_t> startTime,
|
|
std::optional<uint64_t> endTime,
|
|
std::optional<std::string> scAlias) = 0;
|
|
};
|
|
|
|
class NullUsageService : public UsageService {
|
|
public:
|
|
folly::SemiFuture<std::vector<std::string>> getTopUsedDirs(
|
|
std::string_view user,
|
|
std::string_view repo,
|
|
uint32_t numResults,
|
|
std::optional<std::string_view> os,
|
|
std::optional<uint64_t> startTime,
|
|
std::optional<uint64_t> endTime,
|
|
std::optional<std::string> scAlias) override;
|
|
};
|
|
|
|
} // namespace facebook::eden
|