Expand description
Common traits and logic for managing the lifecycle of services
Re-exports§
pub use seqlock::SeqLock;
pub use seqlock::SeqLockReader;
pub use seqlock::SeqLockWriter;
Modules§
- seqlock
- A simple implementation of a sequential lock. More details: https://docs.kernel.org/locking/seqlock.html
- stream
- Re-exports for streaming utilities
- yield_
stream - Stream that yields each
batch_size
items allowing other tasks to work.
Structs§
- Async
Processor - A processor that can execute async tasks with a limit on the number of tasks that can be executed concurrently.
- Empty
Shared - Used if services have no asynchronously shared data
- Service
Runner - The service runner manages the lifecycle, execution and error handling of a
RunnableService
. It can be cloned and passed between threads. - Shared
Mutex - A mutex that can safely be in async contexts and avoids deadlocks.
- State
Watcher - The wrapper around the
watch::Receiver<State>
. It repeats theReceiver
functionality + a new one.
Enums§
- State
- The lifecycle state of the service
- Task
Next Action - The result of a single iteration of the service task
Traits§
- Runnable
Service - Trait used by
ServiceRunner
to encapsulate the business logic tasks for a service. - Runnable
Task - The trait is implemented by the service task and contains a single iteration of the infinity loop.
- Service
- Trait for service runners, providing a minimal interface for managing the lifecycle of services such as start/stop and health status.
- Trace
Err - Helper trait to trace errors
Type Aliases§
- Shared
- Alias for
Arc<T>