Skip to content

Commit 64e0e3f

Browse files
David Tolnayfacebook-github-bot
authored andcommitted
fbcode/fb303/
Reviewed By: zertosh Differential Revision: D69039148 fbshipit-source-id: 7843520b74584a629389694c2486bb0b6ac3ea97
1 parent 111b245 commit 64e0e3f

File tree

10 files changed

+62
-16
lines changed

10 files changed

+62
-16
lines changed

fb303/thrift/BUCK

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ thrift_library(
5151
"serde",
5252
],
5353
thrift_srcs = {"fb303_core.thrift": ["BaseService"]},
54+
deps = [
55+
"//thrift/annotation:cpp",
56+
"//thrift/annotation:thrift",
57+
],
5458
)
5559

5660
export_file(

fb303/thrift/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ doc = false
1818
[dependencies]
1919
anyhow = "1.0.95"
2020
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
21+
cpp = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2122
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2223
futures = { version = "0.3.30", features = ["async-await", "compat"] }
2324
ref-cast = "1.0.18"
2425
serde = { version = "1.0.185", features = ["derive", "rc"] }
2526
serde_derive = "1.0.185"
2627
thiserror = "2"
28+
thrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2729

2830
[build-dependencies]
2931
thrift_compiler = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }

fb303/thrift/clients/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ doc = false
1919
anyhow = "1.0.95"
2020
async-trait = "0.1.71"
2121
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
22+
cpp = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
23+
cpp_clients = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2224
fb303_core__types = { package = "fb303_core", version = "0.0.0", path = ".." }
2325
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2426
futures = { version = "0.3.30", features = ["async-await", "compat"] }
27+
thrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
28+
thrift_clients = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2529
tracing = { version = "0.1.41", features = ["attributes", "valuable"] }
2630

2731
[build-dependencies]

fb303/thrift/clients/thrift_build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ use thrift_compiler::Config;
77
use thrift_compiler::GenContext;
88
const CRATEMAP: &str = "\
99
fb303/thrift/fb303_core.thrift crate //fb303/thrift:fb303_core-rust
10+
thrift/annotation/cpp.thrift cpp //thrift/annotation:cpp-rust
11+
thrift/annotation/scope.thrift cpp->scope //thrift/annotation:scope-rust
12+
thrift/annotation/thrift.thrift thrift //thrift/annotation:thrift-rust
1013
";
1114
#[rustfmt::skip]
1215
fn main() {

fb303/thrift/fb303_core.thrift

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ namespace node_module fb303
2727
namespace go fb303.thrift.fb303_core
2828
namespace js fb303
2929

30+
include "thrift/annotation/cpp.thrift"
31+
include "thrift/annotation/thrift.thrift"
32+
3033
/**
3134
* Common status reporting mechanism across all services
3235
*/
@@ -49,15 +52,19 @@ service BaseService {
4952
/**
5053
* Gets the status of this service
5154
*/
52-
fb303_status getStatus() (
53-
priority = 'IMPORTANT',
54-
cpp.generate_deprecated_header_client_methods,
55-
);
55+
@thrift.DeprecatedUnvalidatedAnnotations{
56+
items = {"cpp.generate_deprecated_header_client_methods": "1"},
57+
}
58+
@thrift.Priority{level = thrift.RpcPriority.IMPORTANT}
59+
fb303_status getStatus();
5660

5761
/**
5862
* Returns a descriptive name of the service
5963
*/
60-
string getName() (cpp.generate_deprecated_header_client_methods);
64+
@thrift.DeprecatedUnvalidatedAnnotations{
65+
items = {"cpp.generate_deprecated_header_client_methods": "1"},
66+
}
67+
string getName();
6168

6269
/**
6370
* Returns the version of the service
@@ -68,44 +75,49 @@ service BaseService {
6875
* User friendly description of status, such as why the service is in
6976
* the dead or warning state, or what is being started or stopped.
7077
*/
71-
string getStatusDetails() (priority = 'IMPORTANT');
78+
@thrift.Priority{level = thrift.RpcPriority.IMPORTANT}
79+
string getStatusDetails();
7280

7381
/**
7482
* Gets the counters for this service
7583
*/
76-
map<string, i64> getCounters() (thread = 'eb');
84+
@cpp.ProcessInEbThreadUnsafe
85+
map<string, i64> getCounters();
7786

7887
/**
7988
* Gets a subset of counters which match a
8089
* Perl Compatible Regular Expression for this service
8190
*/
82-
map<string, i64> getRegexCounters(1: string regex) (thread = 'eb');
91+
@cpp.ProcessInEbThreadUnsafe
92+
map<string, i64> getRegexCounters(1: string regex);
8393

8494
/**
8595
* Get counter values for a specific list of keys. Returns a map from
8696
* key to counter value; if a requested counter doesn't exist, it won't
8797
* be in the returned map.
8898
*/
89-
map<string, i64> getSelectedCounters(1: list<string> keys) (thread = 'eb');
99+
@cpp.ProcessInEbThreadUnsafe
100+
map<string, i64> getSelectedCounters(1: list<string> keys);
90101

91102
/**
92103
* Gets the value of a single counter
93104
*/
94-
i64 getCounter(1: string key) (priority = 'IMPORTANT');
105+
@thrift.Priority{level = thrift.RpcPriority.IMPORTANT}
106+
i64 getCounter(1: string key);
95107

96108
/**
97109
* Gets the exported string values for this service
98110
*/
99-
map<string, string> getExportedValues() (priority = 'IMPORTANT');
111+
@thrift.Priority{level = thrift.RpcPriority.IMPORTANT}
112+
map<string, string> getExportedValues();
100113

101114
/**
102115
* Get exported strings for a specific list of keys. Returns a map from
103116
* key to string value; if a requested key doesn't exist, it won't
104117
* be in the returned map.
105118
*/
106-
map<string, string> getSelectedExportedValues(1: list<string> keys) (
107-
priority = 'IMPORTANT',
108-
);
119+
@thrift.Priority{level = thrift.RpcPriority.IMPORTANT}
120+
map<string, string> getSelectedExportedValues(1: list<string> keys);
109121

110122
/**
111123
* Gets a subset of exported values which match a
@@ -116,7 +128,8 @@ service BaseService {
116128
/**
117129
* Gets the value of a single exported string
118130
*/
119-
string getExportedValue(1: string key) (priority = 'IMPORTANT');
131+
@thrift.Priority{level = thrift.RpcPriority.IMPORTANT}
132+
string getExportedValue(1: string key);
120133

121134
/**
122135
* Sets an option
@@ -136,5 +149,6 @@ service BaseService {
136149
/**
137150
* Returns the unix time that the server has been running since
138151
*/
139-
i64 aliveSince() (priority = 'IMPORTANT');
152+
@thrift.Priority{level = thrift.RpcPriority.IMPORTANT}
153+
i64 aliveSince();
140154
}

fb303/thrift/mocks/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ doc = false
1919
anyhow = "1.0.95"
2020
async-trait = "0.1.71"
2121
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
22+
cpp = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
23+
cpp_clients = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
24+
cpp_mocks = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2225
fb303_core__clients = { package = "fb303_core_clients", version = "0.0.0", path = "../clients" }
2326
fb303_core__types = { package = "fb303_core", version = "0.0.0", path = ".." }
2427
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2528
futures = { version = "0.3.30", features = ["async-await", "compat"] }
29+
thrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
30+
thrift_clients = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
31+
thrift_mocks = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2632
tracing = { version = "0.1.41", features = ["attributes", "valuable"] }
2733

2834
[build-dependencies]

fb303/thrift/mocks/thrift_build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ use thrift_compiler::Config;
77
use thrift_compiler::GenContext;
88
const CRATEMAP: &str = "\
99
fb303/thrift/fb303_core.thrift crate //fb303/thrift:fb303_core-rust
10+
thrift/annotation/cpp.thrift cpp //thrift/annotation:cpp-rust
11+
thrift/annotation/scope.thrift cpp->scope //thrift/annotation:scope-rust
12+
thrift/annotation/thrift.thrift thrift //thrift/annotation:thrift-rust
1013
";
1114
#[rustfmt::skip]
1215
fn main() {

fb303/thrift/services/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ doc = false
1919
anyhow = "1.0.95"
2020
async-trait = "0.1.71"
2121
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
22+
cpp = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
23+
cpp_services = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2224
fb303_core__types = { package = "fb303_core", version = "0.0.0", path = ".." }
2325
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2426
futures = { version = "0.3.30", features = ["async-await", "compat"] }
27+
thrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
28+
thrift_services = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
2529
tracing = { version = "0.1.41", features = ["attributes", "valuable"] }
2630

2731
[build-dependencies]

fb303/thrift/services/thrift_build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ use thrift_compiler::Config;
77
use thrift_compiler::GenContext;
88
const CRATEMAP: &str = "\
99
fb303/thrift/fb303_core.thrift crate //fb303/thrift:fb303_core-rust
10+
thrift/annotation/cpp.thrift cpp //thrift/annotation:cpp-rust
11+
thrift/annotation/scope.thrift cpp->scope //thrift/annotation:scope-rust
12+
thrift/annotation/thrift.thrift thrift //thrift/annotation:thrift-rust
1013
";
1114
#[rustfmt::skip]
1215
fn main() {

fb303/thrift/thrift_build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ use thrift_compiler::Config;
77
use thrift_compiler::GenContext;
88
const CRATEMAP: &str = "\
99
fb303/thrift/fb303_core.thrift crate //fb303/thrift:fb303_core-rust
10+
thrift/annotation/cpp.thrift cpp //thrift/annotation:cpp-rust
11+
thrift/annotation/scope.thrift cpp->scope //thrift/annotation:scope-rust
12+
thrift/annotation/thrift.thrift thrift //thrift/annotation:thrift-rust
1013
";
1114
#[rustfmt::skip]
1215
fn main() {

0 commit comments

Comments
 (0)