Skip to content

Commit

Permalink
Expose reflection metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
mildbyte committed Dec 30, 2023
1 parent a565470 commit 3f365c1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clade/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
use std::env;
use std::path::PathBuf;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
tonic_build::configure()
.file_descriptor_set_path(out_dir.join("clade_descriptor.bin"))
.build_server(true)
.build_client(true)
.compile(&["proto/catalog.proto", "proto/schema.proto"], &["proto"])?;
Expand Down
1 change: 1 addition & 0 deletions clade/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ pub mod catalog {

pub mod schema {
tonic::include_proto!("clade.schema");
pub const FILE_DESCRIPTOR_SET: &[u8] = tonic::include_file_descriptor_set!("clade_descriptor");
}
7 changes: 7 additions & 0 deletions tests/clade/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use clade::catalog::{CatalogReference, TableObject};
use clade::schema::{
schema_store_service_server::{SchemaStoreService, SchemaStoreServiceServer},
FILE_DESCRIPTOR_SET,
ListSchemaResponse, SchemaObject,
};
use datafusion_common::assert_batches_eq;
Expand Down Expand Up @@ -84,8 +85,14 @@ async fn run_clade_server(addr: SocketAddr) {

let svc = SchemaStoreServiceServer::new(metastore);

let reflection = tonic_reflection::server::Builder::configure()
.register_encoded_file_descriptor_set(FILE_DESCRIPTOR_SET)
.build()
.unwrap();

Server::builder()
.add_service(svc)
.add_service(reflection)
.serve(addr)
.await
.unwrap();
Expand Down

0 comments on commit 3f365c1

Please sign in to comment.