mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-04 03:52:56 +00:00
## Problem A binary Protobuf schema descriptor can be used to expose an API reflection service, which in turn allows convenient usage of e.g. `grpcurl` against the gRPC server. Touches #11728. ## Summary of changes * Generate a binary schema descriptor as `pageserver_page_api::proto::FILE_DESCRIPTOR_SET`. * Opportunistically rename the Protobuf package from `page_service` to `page_api`.
14 lines
508 B
Rust
14 lines
508 B
Rust
use std::env;
|
|
use std::path::PathBuf;
|
|
|
|
/// Generates Rust code from .proto Protobuf schemas, along with a binary file
|
|
/// descriptor set for Protobuf schema reflection.
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
let out_dir = PathBuf::from(env::var("OUT_DIR")?);
|
|
tonic_build::configure()
|
|
.bytes(["."])
|
|
.file_descriptor_set_path(out_dir.join("page_api_descriptor.bin"))
|
|
.compile_protos(&["proto/page_service.proto"], &["proto"])
|
|
.map_err(|err| err.into())
|
|
}
|