ServiceState

Trait ServiceState 

Source
pub trait ServiceState {
    // Required methods
    fn nid(&self) -> &NodeId;
    fn sessions(&self) -> &Sessions;
    fn fetching(&self) -> &HashMap<RepoId, FetchState>;
    fn outbox(&self) -> &Outbox ;
    fn limiter(&self) -> &RateLimiter;
    fn emitter(&self) -> &Emitter<Event>;
    fn get(&self, rid: RepoId) -> Result<Option<Doc>, RepositoryError>;
    fn clock(&self) -> &LocalTime;
    fn clock_mut(&mut self) -> &mut LocalTime;
    fn config(&self) -> &Config;
    fn metrics(&self) -> &Metrics;
}
Expand description

Gives read access to the service state.

Required Methods§

Source

fn nid(&self) -> &NodeId

Get the Node ID.

Source

fn sessions(&self) -> &Sessions

Get the existing sessions.

Source

fn fetching(&self) -> &HashMap<RepoId, FetchState>

Get fetch state.

Source

fn outbox(&self) -> &Outbox

Get outbox.

Source

fn limiter(&self) -> &RateLimiter

Get rate limiter.

Source

fn emitter(&self) -> &Emitter<Event>

Get event emitter.

Source

fn get(&self, rid: RepoId) -> Result<Option<Doc>, RepositoryError>

Get a repository from storage.

Source

fn clock(&self) -> &LocalTime

Get the clock.

Source

fn clock_mut(&mut self) -> &mut LocalTime

Get the clock mutably.

Source

fn config(&self) -> &Config

Get service configuration.

Source

fn metrics(&self) -> &Metrics

Get service metrics.

Implementors§

Source§

impl<D, S, G> ServiceState for Service<D, S, G>
where D: Store, G: Signer<Signature>, S: ReadStorage,