sapling/eden/fs/service/UsageService.h
Chad Austin 75a5678622 remove some ifdefs by introducing a platform-independent UsageService class
Summary:
Naming the concept allows us to decouple implementation details and
imagine future implementations.

Reviewed By: kmancini

Differential Revision: D45917739

fbshipit-source-id: d0d0a023c2d978c8a509af0e7187295b4c9c413b
2023-05-17 19:16:48 -07:00

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