forked from facebook/watchman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QueryableView.h
77 lines (62 loc) · 2.38 KB
/
QueryableView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* Copyright 2016-present Facebook, Inc.
* Licensed under the Apache License, Version 2.0 */
#pragma once
#include "watchman_string.h"
#include <future>
#include <vector>
#include "watchman_perf.h"
#include "watchman_query.h"
struct watchman_file;
struct watchman_dir;
struct watchman_glob_tree;
namespace watchman {
class SCM;
class QueryableView : public std::enable_shared_from_this<QueryableView> {
public:
virtual ~QueryableView();
/**
* Perform a time-based (since) query and emit results to the supplied
* query context.
*/
virtual void timeGenerator(w_query* query, struct w_query_ctx* ctx) const;
/**
* Walks files that match the supplied set of paths.
*/
virtual void pathGenerator(w_query* query, struct w_query_ctx* ctx) const;
virtual void globGenerator(w_query* query, struct w_query_ctx* ctx) const;
virtual void allFilesGenerator(w_query* query, struct w_query_ctx* ctx) const;
virtual ClockPosition getMostRecentRootNumberAndTickValue() const = 0;
virtual w_string getCurrentClockString() const = 0;
virtual uint32_t getLastAgeOutTickValue() const;
virtual std::chrono::system_clock::time_point getLastAgeOutTimeStamp() const;
virtual void ageOut(w_perf_t& sample, std::chrono::seconds minAge);
virtual void syncToNow(
const std::shared_ptr<watchman_root>& root,
std::chrono::milliseconds timeout) = 0;
// Specialized query function that is used to test whether
// version control files exist as part of some settling handling.
// It should query the view and return true if any of the named
// files current exist in the view.
virtual bool doAnyOfTheseFilesExist(
const std::vector<w_string>& fileNames) const = 0;
bool isVCSOperationInProgress() const;
/**
* Start up any helper threads.
*/
virtual void startThreads(const std::shared_ptr<watchman_root>& /*root*/) {}
/**
* Request that helper threads shutdown (but does not join them).
*/
virtual void signalThreads() {}
/**
* Request that helper threads wake up and re-evaluate their state.
*/
virtual void wakeThreads() {}
virtual const w_string& getName() const = 0;
virtual json_ref getWatcherDebugInfo() const = 0;
virtual std::shared_future<void> waitUntilReadyToQuery(
const std::shared_ptr<watchman_root>& root) = 0;
// Return the SCM detected for this watched root
virtual SCM* getSCM() const = 0;
};
} // namespace watchman