Skip to main content

RpcServer

Struct RpcServer 

Source
pub struct RpcServer {
    pub server_id: String,
    /* private fields */
}
Expand description

The RPC server — holds method registrations and dispatches requests.

Fields§

§server_id: String

Implementations§

Source§

impl RpcServer

Source

pub fn new(server_id: impl Into<String>) -> Self

Create a new RpcServer. For richer configuration, use RpcServer::builder.

Source

pub fn builder() -> RpcServerBuilder

Create a new builder.

Source

pub fn protocol_name(&self) -> &str

Source

pub fn describe_enabled(&self) -> bool

Source

pub fn server_version(&self) -> &str

Source

pub fn protocol_version(&self) -> &str

Source

pub fn protocol_hash(&self) -> &str

SHA-256 hex digest of the canonical describe payload. Computed lazily on first call and cached.

Source

pub fn external_config(&self) -> Option<&Arc<ExternalLocationConfig>>

Source

pub fn transport_kind(&self) -> Option<TransportKind>

Currently-bound TransportKind, or None before the framework has observed a transport. Set by notify_transport.

Source

pub fn transport_capabilities(&self) -> TransportCapabilities

Currently-advertised TransportCapabilities. Empty (all-false) before a transport is bound and for transports without extra capabilities.

Source

pub fn notify_transport(&self, kind: TransportKind, caps: TransportCapabilities)

Bind the server to a transport, firing on_serve_start once per (kind, caps) combination. Subsequent calls with the same combination are cheap no-ops (the common case where transport glue invokes this on every request). A different combination updates the bound state and re-fires the hook — matches the Python _notify_transport contract.

Call this from each transport entry point:

  • stdio / pipe main: once before serve
  • Unix accept loop: once per process
  • HTTP request handler: every request (idempotent)
Source

pub fn register(&mut self, info: MethodInfo)

Register a method described by a MethodInfo.

Source

pub fn register_unary( &mut self, name: impl Into<String>, result_schema: SchemaRef, handler: impl Fn(&Request, &CallContext) -> Result<Option<RecordBatch>> + Send + Sync + 'static, )

Convenience wrapper for the old positional API — equivalent to register(MethodInfo::unary(name, empty_schema(), result_schema, handler)). Prefer MethodInfo::unary + RpcServer::register for new code.

Source

pub fn register_stream( &mut self, name: impl Into<String>, method_type: MethodType, handler: impl Fn(&Request, &CallContext) -> Result<StreamResult> + Send + Sync + 'static, )

Convenience wrapper for the old positional API — equivalent to register(MethodInfo::stream(name, method_type, empty_schema(), handler)). Prefer MethodInfo::stream + RpcServer::register for new code.

Source

pub fn method(&self, name: &str) -> Option<&MethodInfo>

Source

pub fn methods(&self) -> &HashMap<String, MethodInfo>

Source

pub fn method_names(&self) -> Vec<&str>

Source

pub fn sorted_method_names(&self) -> Vec<&str>

Method names sorted alphabetically. Preferred over methods().keys() when order matters (introspection / describe / HTML rendering).

Source

pub fn serve<R: Read, W: Write>(&self, r: R, w: W)

Run the serve loop over a single reader/writer pair (pipe or socket).

Reads are blocking with no timeout — a peer that opens the connection and then stalls pins this thread until it sends data, EOFs, or resets. stdio/pipe has no timeout API, so that transport is trusted-peer-only (see also the SHM module docs). On a socket transport, the caller owns the stream and should set a read timeout (e.g. UnixStream::set_read_timeout) before handing it here; a TimedOut/WouldBlock error then cleanly ends the connection via the error path below.

Source

pub fn serve_with_shutdown<R, W, F>(&self, r: R, w: W, shutdown: F)
where R: Read, W: Write, F: Fn() -> bool,

Like [serve], but checks shutdown between requests and exits cleanly when it returns true. Useful for daemonized pipe/unix listeners that want to drain the in-flight request before exiting on SIGTERM. Blocking reads still must terminate via EOF/peer-close — this is an advisory signal checked at request boundaries.

Source

pub fn serve_one<R: Read, W: Write>(&self, r: &mut R, w: &mut W) -> Result<bool>

Handle one request. Returns Ok(true) to continue, Ok(false) on EOS/EOF.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more