page_api: tweaks

This commit is contained in:
Erik Grinaker
2025-04-29 17:23:51 +02:00
parent 0f520d79ab
commit b86c610f42
4 changed files with 15 additions and 11 deletions

View File

@@ -17,9 +17,9 @@ use pageserver_page_api::proto;
type Shardno = u16;
use pageserver_page_api::client::PageServiceClient;
use pageserver_page_api::proto::PageServiceClient;
type MyPageServiceClient = pageserver_page_api::client::PageServiceClient<
type MyPageServiceClient = pageserver_page_api::proto::PageServiceClient<
tonic::service::interceptor::InterceptedService<tonic::transport::Channel, AuthInterceptor>,
>;

View File

@@ -3,6 +3,5 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
.bytes(["."])
.compile_protos(&["proto/page_service.proto"], &["proto"])
.unwrap_or_else(|e| panic!("failed to compile protos {:?}", e));
Ok(())
.map_err(|err| err.into())
}

View File

@@ -1,17 +1,19 @@
//! This crate has two modules related to the Pageserver Data API:
//! This crate provides the Pageserver's page API. It contains:
//!
//! proto: code auto-generated from the protobuf definition
//! model: slightly more ergonomic structs representing the same API
//! * proto: auto-generated Protobuf types for gRPC.
//! * model: canonical domain types. Protobuf types are converted into these.
//!
//! See protobuf spec under the protos/ subdirectory.
//! See `proto/page_service.proto` for the protocol spec.
//!
//! This crate is used by both the client and the server. Try to keep it slim.
//!
pub mod model;
// Code generated by protobuf.
pub mod proto {
tonic::include_proto!("page_service");
}
pub use proto::page_service_client as client;
pub use page_service_client::PageServiceClient;
pub use page_service_server::PageServiceServer;
}

View File

@@ -1,4 +1,4 @@
//! Structs representing the API
//! Structs representing the canonical page service API.
//!
//! These mirror the pageserver APIs and the structs automatically generated
//! from the protobuf specification. The differences are:
@@ -8,6 +8,9 @@
//! (See https://github.com/tokio-rs/prost/issues/800 for a gripe on this)
//!
//! - Use more precise datatypes, e.g. Lsn and uints shorter than 32 bits.
//!
//! TODO: these types should be used in the Pageserver for actual processing,
//! instead of being cast into internal mirror types.
use utils::lsn::Lsn;