Skip to main content

Options

Struct Options 

Source
pub struct Options { /* private fields */ }
Expand description

How to reach the kernel and as whom: the options of Kernable::new, set with builder methods that each return the changed options.

Options::default() takes everything from the environment, else the defaults: the key from KERNABLE_KEY, else app.key in the current directory; the kernel from KERNABLE_URL, else http://127.0.0.1:7233; the grant from KERNABLE_GRANT, else the .grant file next to the key; the service from KERNABLE_SERVICE; the deployment from KERNABLE_DEPLOYMENT; TLS from KERNABLE_TLS_CA, KERNABLE_TLS_CERT and KERNABLE_TLS_KEY; the tenant default. A key file’s path (&str, String, &Path, PathBuf) converts into options with only the key set, so Kernable::new("app.key") works too. Example: Kernable::new(Options::new("shop.key").url("http://kernel:7233").service("shop"))?.

Implementations§

Source§

impl Options

Source

pub fn new(key: impl AsRef<Path>) -> Options

Options that sign with the key in the .key file at key (made with kernable keys new), every other option at its default.

Source

pub fn url(self, url: impl Into<String>) -> Options

Kernel address: http://host:port (host:port works too) or, on Unix, unix:/path/to.sock. For a pair of kernels with a standby, both, comma-separated (http://a:7233,http://b:7233): the client turns to the other one when a kernel answers UNAVAILABLE (a standby says not_primary) or cannot be reached. Default: KERNABLE_URL, else http://127.0.0.1:7233, where kernable start listens.

Source

pub fn grant(self, path: impl AsRef<Path>) -> Options

The key’s grant (kernable grant), sent with every call. Default: KERNABLE_GRANT, else the .grant file next to the key file, if there is one.

Source

pub fn tenant(self, tenant: impl Into<String>) -> Options

Default tenant for submit, query, files and the cache (default default).

Source

pub fn service(self, service: impl Into<String>) -> Options

The service this process’s workers and listeners belong to. The service’s membership (see Kernable::apply) decides what the kernel waits for: what it lists counts, the service’s other workers and listeners are dynamic, and only listeners it lists as middlewares may check requests. Default: KERNABLE_SERVICE, else none (everything registered counts).

Source

pub fn deployment(self, deployment: impl Into<String>) -> Options

The deployment of this process: the version of its code, e.g. 2026-11-11.1 or a commit hash; 1 to 128 letters, digits, -, _ and .. Its workers write it into every event and get commands only while the service’s membership names it (or names none); its read models and middlewares run beside those of other deployments, each from its own position, and its queries go to its own read models first. Kernable::apply names it in the membership, so a rollback is starting the earlier code and applying again. Default: KERNABLE_DEPLOYMENT, else none. An invalid one is Error::Config in Kernable::new.

Source

pub fn context(self, context: RequestContext) -> Options

Default request context, e.g. this service’s identity; a request’s own context replaces it.

Source

pub fn tls(self, tls: Tls) -> Options

Mutual TLS for host:port URLs: the CA certificate and this process’s certificate and key, as paths of PEM files (Tls { ca, cert, key }, re-exported from the kernel’s crate). Default: KERNABLE_TLS_CA, KERNABLE_TLS_CERT and KERNABLE_TLS_KEY, if set (all three or none).

Source

pub fn insecure(self) -> Options

Allows plain text to a kernel that is not on this machine. Without TLS, grants, signed requests and vault values cross the network readable, so Kernable::new refuses such a URL unless this is set. Default: KERNABLE_INSECURE=1, else not allowed.

Source

pub fn timeout(self, timeout: Duration) -> Options

How long a request (submit, query, files, cache, apply) waits in all: for the connection, e.g. while the kernel restarts, and for its answer. Default 60 s. A connection the network dropped silently is noticed within 40 s by keepalive pings, within 4 s with several kernels (a pair), whose client then turns to the other. A submit (by its command ID), a cancel, a query or a data or cache read (get, list) that a kernel answers UNAVAILABLE (shutting down, handing over, a middleware or read model not connected) is asked again with backoff within this time; any other request (a write) may have run, and fails at once.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Options

Every option at its default: the key from KERNABLE_KEY, else app.key in the current directory; the service from KERNABLE_SERVICE, if set; the deployment from KERNABLE_DEPLOYMENT, if set; TLS from KERNABLE_TLS_CA, KERNABLE_TLS_CERT and KERNABLE_TLS_KEY, if set.

Source§

fn default() -> Options

Returns the “default value” for a type. Read more
Source§

impl From<&Path> for Options

Source§

fn from(key: &Path) -> Options

Converts to this type from the input type.
Source§

impl From<&str> for Options

The options for the key file at a path, with every other option at its default.

Source§

fn from(key: &str) -> Options

Converts to this type from the input type.
Source§

impl From<PathBuf> for Options

Source§

fn from(key: PathBuf) -> Options

Converts to this type from the input type.
Source§

impl From<String> for Options

Source§

fn from(key: String) -> Options

Converts to this type from the input type.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<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