pub struct RelayServiceServer<T> { /* private fields */ }Expand description
A relay (kernable relay, or kernable Cloud’s): it keeps copies of writers’ records outside
their networks, and readers follow a copy there. It holds the records only; it applies none. A
pusher beside the writer (kernable push) follows the writer as a reader does and sends what it
gets on, over a connection it opens itself, so the writer accepts none from outside. Readers
follow a copy as they follow a writer (ReplicationService.Follow, reader, copy), and check
every record against the writer’s checkpoints as they always do: a relay can withhold records,
never change one.
What reaches a relay is sealed with the copy key, which the pusher and the copy’s readers hold and the relay does not: each record (ReplicatedRecord.sealed), each record batch’s vault values and files (RecordBatch.sealed), each image batch (ImageBatch.sealed) and the image’s length (ImageEnd.sealed). A relay sees records’ positions, hashes and sizes, nothing else. A sealed value is the key’s ID (the first 8 bytes of its SHA-256), a random 24-byte nonce and the XChaCha20-Poly1305 ciphertext, its associated data a label of what it is and where it belongs (see the kernel’s src/seal.rs), so a relay cannot move one elsewhere unnoticed. Every stream at a relay (Push, Calls, and Follow of ReplicationService) names its key and copy in its request, signed, so the relay refuses a stranger before it reads any message: headers kernable-relay-key (key ID), kernable-relay-copy, kernable-relay-at (ms since the epoch, within 60 s of the relay’s clock) and kernable-relay-sig (hex, Ed25519 by that key over the message “kernable.v1.relay-stream” | rpc (“push”, “calls”, “follow”) | copy | key ID | at, laid out as in SIGNING.md). The stream’s hello must name the same key and copy; the challenge follows as before.
Implementations§
Source§impl<T> RelayServiceServer<T>
impl<T> RelayServiceServer<T>
pub fn new(inner: T) -> Self
pub fn from_arc(inner: Arc<T>) -> Self
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>where
F: Interceptor,
Sourcepub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
pub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
Enable decompressing requests with the given encoding.
Sourcepub fn send_compressed(self, encoding: CompressionEncoding) -> Self
pub fn send_compressed(self, encoding: CompressionEncoding) -> Self
Compress responses with the given encoding, if the client supports it.
Sourcepub fn max_decoding_message_size(self, limit: usize) -> Self
pub fn max_decoding_message_size(self, limit: usize) -> Self
Limits the maximum size of a decoded message.
Default: 4MB
Sourcepub fn max_encoding_message_size(self, limit: usize) -> Self
pub fn max_encoding_message_size(self, limit: usize) -> Self
Limits the maximum size of an encoded message.
Default: usize::MAX
Trait Implementations§
Source§impl<T> Clone for RelayServiceServer<T>
impl<T> Clone for RelayServiceServer<T>
Source§impl<T: Debug> Debug for RelayServiceServer<T>
impl<T: Debug> Debug for RelayServiceServer<T>
Source§impl<T> NamedService for RelayServiceServer<T>
impl<T> NamedService for RelayServiceServer<T>
Source§impl<T, B> Service<Request<B>> for RelayServiceServer<T>
impl<T, B> Service<Request<B>> for RelayServiceServer<T>
Source§type Future = Pin<Box<dyn Future<Output = Result<<RelayServiceServer<T> as Service<Request<B>>>::Response, <RelayServiceServer<T> as Service<Request<B>>>::Error>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<<RelayServiceServer<T> as Service<Request<B>>>::Response, <RelayServiceServer<T> as Service<Request<B>>>::Error>> + Send>>
Auto Trait Implementations§
impl<T> Forget for RelayServiceServer<T>
impl<T> Freeze for RelayServiceServer<T>
impl<T> Move for RelayServiceServer<T>
impl<T> RefUnwindSafe for RelayServiceServer<T>
impl<T> Send for RelayServiceServer<T>
impl<T> Sync for RelayServiceServer<T>
impl<T> Unpin for RelayServiceServer<T>
impl<T> UnsafeUnpin for RelayServiceServer<T>
impl<T> UnwindSafe for RelayServiceServer<T>where
Arc<T>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, ReqBody, ResBody> GrpcService<ReqBody> for T
impl<T, ReqBody, ResBody> GrpcService<ReqBody> for T
Source§type ResponseBody = ResBody
type ResponseBody = ResBody
Source§fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), <T as GrpcService<ReqBody>>::Error>>
fn poll_ready( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), <T as GrpcService<ReqBody>>::Error>>
Ready when the service is able to process requests. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<S, R> ServiceExt<R> for Swhere
S: Service<R>,
impl<S, R> ServiceExt<R> for Swhere
S: Service<R>,
Source§fn into_make_service(self) -> IntoMakeService<S>
fn into_make_service(self) -> IntoMakeService<S>
MakeService, that is a Service whose
response is another service. Read moreSource§fn handle_error<F, T>(self, f: F) -> HandleError<Self, F, T>
fn handle_error<F, T>(self, f: F) -> HandleError<Self, F, T>
HandleError, that will handle errors
by converting them into responses. Read moreSource§impl<T, Request> ServiceExt<Request> for T
impl<T, Request> ServiceExt<Request> for T
Source§fn ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
Source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
Source§fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
Service, calling it with the provided request once it is ready.Source§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
poll_ready method. Read moreSource§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
poll_ready method. Read moreSource§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
poll_ready method. Read moreSource§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Result<Self::Response, Self::Error>)
to a different value, regardless of whether the future succeeds or
fails. Read more