#applications #config-file #cli-parser #framework #system #service #signal

system-service

Framework to handle logging, signals, etc. so you can focus on business logic

4 releases

Uses old Rust 2015

0.2.2 Apr 20, 2018
0.2.1 Apr 20, 2018
0.2.0 Apr 20, 2018
0.1.0 Apr 10, 2018

#101 in #cli-parser

Apache-2.0

13KB
171 lines

system-service

A framework for writing system services

About

Every application which runs as a service should implement things like logging, signal handling, graceful shutdown, CLI option parsing, and configuration file parsing. This package provides a semi-opinionated framework for doing so.

Documentation

For usage instructions, please see the crate documentation.


lib.rs:

A framework for writing system services

About

Every application which runs as a service should implement things like logging, signal handling, graceful shutdown, CLI option parsing, and configuration file parsing. This package provides a semi-opinionated framework for doing so.

Usage

There are several traits exported here including Application, Config, Options, and LogOptions. The two options traits should be implemented for your CLI option loadind, Config for your config file loading, and Application for your application logic.

The primary run method is Application::run_once which is called over and over again in a loop. It is provided a Context type which gives the application control of when it checks for signals. Any received signals are passed to Application::received_signal for handling.

Once Application::run_once returns Stopping::Yes, the main loop terminates and invokes Application::shutdown before exitting.

Dependencies

~3–11MB
~109K SLoC