pub struct Service { /* private fields */ }Expand description
A native service and the extensions it provides.
Implementations§
Source§impl Service
impl Service
Sourcepub fn extension<C: Into<String>>(
self,
name: impl Into<String>,
extension: impl Extension,
callers: impl IntoIterator<Item = C>,
) -> Self
pub fn extension<C: Into<String>>( self, name: impl Into<String>, extension: impl Extension, callers: impl IntoIterator<Item = C>, ) -> Self
Provide extension as name to callers: service names, or * for
every service of the tenant.
Sourcepub fn concurrency(self, calls: usize) -> Self
pub fn concurrency(self, calls: usize) -> Self
Run at most calls calls at once (64 unless set); the others wait
for a slot until their deadline.
Sourcepub fn manifest(&self) -> Result<ServiceManifest>
pub fn manifest(&self) -> Result<ServiceManifest>
The mode: native manifest of the service, which the CLI deploys:
its name and what it provides, each extension’s callers in order,
once each.
Sourcepub fn run(self) -> ExitCode
pub fn run(self) -> ExitCode
Run the service as its binary’s main: print its manifest under
--emit-manifest, else serve the Unix socket CUFFLINK_EXT_SOCKET
names, to requests bearing the token CUFFLINK_EXT_TOKEN holds, until
SIGTERM or SIGINT. Fails, saying why, when the service or its
environment is invalid.
On Linux the process first makes itself undumpable, so other processes of its user (the runner’s other children) cannot read its environment or memory.
Sourcepub fn run_nats(self, provider: NatsProvider) -> Result<()>
pub fn run_nats(self, provider: NatsProvider) -> Result<()>
Serve the extensions from NATS as provider until SIGTERM or
SIGINT, undumpable on Linux as run is.
Sourcepub async fn bind_socket(self, path: impl AsRef<Path>) -> Result<SocketServer>
pub async fn bind_socket(self, path: impl AsRef<Path>) -> Result<SocketServer>
Listen on the Unix socket path, replacing a stale one.
Sourcepub async fn bind_nats(self, provider: NatsProvider) -> Result<NatsServer>
pub async fn bind_nats(self, provider: NatsProvider) -> Result<NatsServer>
Connect to provider’s NATS and subscribe to the calls of each
extension in the queue group every provider shares.