mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-25 17:10:38 +00:00
Add grpc pagebench for communicator grpc.
This commit is contained in:
@@ -18,6 +18,6 @@ pub mod proto {
|
||||
pub use page_service_server::{PageService, PageServiceServer};
|
||||
}
|
||||
|
||||
mod model;
|
||||
pub mod model;
|
||||
|
||||
pub use model::*;
|
||||
|
||||
@@ -102,6 +102,15 @@ impl TryFrom<ReadLsn> for proto::ReadLsn {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ReadLsn> for proto::ReadLsn {
|
||||
fn from(value: &ReadLsn) -> proto::ReadLsn {
|
||||
proto::ReadLsn {
|
||||
request_lsn: value.request_lsn.into(),
|
||||
not_modified_since_lsn: value.not_modified_since_lsn.unwrap_or_default().0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RelTag is defined in pageserver_api::reltag.
|
||||
pub type RelTag = pageserver_api::reltag::RelTag;
|
||||
|
||||
@@ -132,6 +141,16 @@ impl From<RelTag> for proto::RelTag {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&RelTag> for proto::RelTag {
|
||||
fn from(value: &RelTag) -> proto::RelTag {
|
||||
proto::RelTag {
|
||||
spc_oid: value.spcnode,
|
||||
db_oid: value.dbnode,
|
||||
rel_number: value.relnode,
|
||||
fork_number: value.forknum as u32,
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Checks whether a relation exists, at the given LSN. Only valid on shard 0, other shards error.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct CheckRelExistsRequest {
|
||||
@@ -153,6 +172,14 @@ impl TryFrom<proto::CheckRelExistsRequest> for CheckRelExistsRequest {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&CheckRelExistsRequest> for proto::CheckRelExistsRequest {
|
||||
fn from(value: &CheckRelExistsRequest) -> proto::CheckRelExistsRequest {
|
||||
proto::CheckRelExistsRequest {
|
||||
read_lsn: Some((&value.read_lsn).into()),
|
||||
rel: Some((&value.rel).into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
pub type CheckRelExistsResponse = bool;
|
||||
|
||||
impl From<proto::CheckRelExistsResponse> for CheckRelExistsResponse {
|
||||
@@ -190,6 +217,15 @@ impl TryFrom<proto::GetBaseBackupRequest> for GetBaseBackupRequest {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&GetBaseBackupRequest> for proto::GetBaseBackupRequest {
|
||||
fn from(value: &GetBaseBackupRequest) -> proto::GetBaseBackupRequest {
|
||||
proto::GetBaseBackupRequest {
|
||||
read_lsn: Some((&value.read_lsn).into()),
|
||||
replica: value.replica,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<GetBaseBackupRequest> for proto::GetBaseBackupRequest {
|
||||
type Error = ProtocolError;
|
||||
|
||||
@@ -246,6 +282,14 @@ impl TryFrom<proto::GetDbSizeRequest> for GetDbSizeRequest {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&GetDbSizeRequest> for proto::GetDbSizeRequest {
|
||||
fn from(value: &GetDbSizeRequest) -> proto::GetDbSizeRequest {
|
||||
proto::GetDbSizeRequest {
|
||||
read_lsn: Some((&value.read_lsn).into()),
|
||||
db_oid: value.db_oid,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TryFrom<GetDbSizeRequest> for proto::GetDbSizeRequest {
|
||||
type Error = ProtocolError;
|
||||
|
||||
@@ -311,6 +355,17 @@ impl TryFrom<proto::GetPageRequest> for GetPageRequest {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&GetPageRequest> for proto::GetPageRequest {
|
||||
fn from(request: &GetPageRequest) -> proto::GetPageRequest {
|
||||
proto::GetPageRequest {
|
||||
request_id: request.request_id,
|
||||
request_class: request.request_class.into(),
|
||||
read_lsn: Some(request.read_lsn.try_into().unwrap()),
|
||||
rel: Some(request.rel.into()),
|
||||
block_number: request.block_numbers.clone().into_vec(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TryFrom<GetPageRequest> for proto::GetPageRequest {
|
||||
type Error = ProtocolError;
|
||||
|
||||
@@ -505,6 +560,14 @@ impl TryFrom<proto::GetRelSizeRequest> for GetRelSizeRequest {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&GetRelSizeRequest> for proto::GetRelSizeRequest {
|
||||
fn from(value: &GetRelSizeRequest) -> proto::GetRelSizeRequest {
|
||||
proto::GetRelSizeRequest {
|
||||
read_lsn: Some((&value.read_lsn).into()),
|
||||
rel: Some((&value.rel).into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl TryFrom<GetRelSizeRequest> for proto::GetRelSizeRequest {
|
||||
type Error = ProtocolError;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user