fork of https://github.com/sourcegraph/zoekt
1syntax = "proto3";
2
3package grpc.v1;
4
5option go_package = "github.com/sourcegraph/zoekt/grpc/v1";
6
7message Q {
8 oneof query {
9 RawConfig raw_config = 1;
10 Regexp regexp = 2;
11 Symbol symbol = 3;
12 Language language = 4;
13 bool const = 5;
14 Repo repo = 6;
15 RepoRegexp repo_regexp = 7;
16 BranchesRepos branches_repos = 8;
17 RepoIds repo_ids = 9;
18 RepoSet repo_set = 10;
19 FileNameSet file_name_set = 11;
20 Type type = 12;
21 Substring substring = 13;
22 And and = 14;
23 Or or = 15;
24 Not not = 16;
25 Branch branch = 17;
26 }
27}
28
29// RawConfig filters repositories based on their encoded RawConfig map.
30message RawConfig {
31 enum Flag {
32 UNKNOWN = 0x00;
33 ONLY_PUBLIC = 0x01;
34 ONLY_PRIVATE = 0x02;
35 ONLY_FORKS = 0x04;
36 NO_FORKS = 0x08;
37 ONLY_ARCHIVED = 0x10;
38 NO_ARCHIVED = 0x20;
39 }
40
41 repeated Flag flags = 1;
42}
43
44// Regexp is a query looking for regular expressions matches.
45message Regexp {
46 string regexp = 1;
47 bool file_name = 2;
48 bool content = 3;
49 bool case_sensitive = 4;
50}
51
52message Symbol {
53 Q expr = 1;
54}
55
56message Language {
57 string language = 1;
58}
59
60message Repo {
61 string regexp = 1;
62}
63
64message RepoRegexp {
65 string regexp = 1;
66}
67
68// BranchesRepos is a slice of BranchRepos to match.
69message BranchesRepos {
70 repeated BranchRepos list = 1;
71}
72
73// BranchRepos is a (branch, sourcegraph repo ids bitmap) tuple. It is a
74// Sourcegraph addition.
75message BranchRepos {
76 string branch = 1;
77 // a serialized roaring bitmap of the target repo ids
78 bytes repos = 2;
79}
80
81// Similar to BranchRepos but will be used to match only by repoid and
82// therefore matches all branches
83message RepoIds {
84 // a serialized roaring bitmap of the target repo ids
85 bytes repos = 1;
86}
87
88// RepoSet is a list of repos to match.
89message RepoSet {
90 map<string, bool> set = 1;
91}
92
93// FileNameSet is a list of file names to match.
94message FileNameSet {
95 repeated string set = 1;
96}
97
98// Type changes the result type returned.
99message Type {
100 enum Kind {
101 UNKNOWN = 0;
102 FILE_MATCH = 1;
103 FILE_NAME = 2;
104 REPO = 3;
105 }
106
107 Q child = 1;
108 // TODO: type constants
109 Kind type = 2;
110}
111
112message Substring {
113 string pattern = 1;
114 bool case_sensitive = 2;
115
116 // Match only filename
117 bool file_name = 3;
118
119 // Match only content
120 bool content = 4;
121}
122
123// And is matched when all its children are.
124message And {
125 repeated Q children = 1;
126}
127
128// Or is matched when any of its children is matched.
129message Or {
130 repeated Q children = 1;
131}
132
133// Not inverts the meaning of its child.
134message Not {
135 Q child = 1;
136}
137
138// Branch limits search to a specific branch.
139message Branch {
140 string pattern = 1;
141 // exact is true if we want to Pattern to equal branch.
142 bool exact = 2;
143}