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
impl Options
Sourcepub fn new(key: impl AsRef<Path>) -> Options
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.
Sourcepub fn url(self, url: impl Into<String>) -> Options
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.
Sourcepub fn grant(self, path: impl AsRef<Path>) -> Options
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.
Sourcepub fn tenant(self, tenant: impl Into<String>) -> Options
pub fn tenant(self, tenant: impl Into<String>) -> Options
Default tenant for submit, query, files and the cache (default default).
Sourcepub fn service(self, service: impl Into<String>) -> Options
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).
Sourcepub fn deployment(self, deployment: impl Into<String>) -> Options
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.
Sourcepub fn context(self, context: RequestContext) -> Options
pub fn context(self, context: RequestContext) -> Options
Default request context, e.g. this service’s identity; a request’s own context replaces it.
Sourcepub fn tls(self, tls: Tls) -> Options
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).
Sourcepub fn insecure(self) -> Options
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.
Sourcepub fn timeout(self, timeout: Duration) -> Options
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 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.
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§impl From<&str> for Options
The options for the key file at a path, with every other option at its default.
impl From<&str> for Options
The options for the key file at a path, with every other option at its default.
Auto Trait Implementations§
impl Forget for Options
impl Freeze for Options
impl Move for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnsafeUnpin for Optionswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
impl UnwindSafe for Options
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> 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::Request