Struct dht::service::Service [] [src]

pub struct Service<TId, TNodeTable, TData> where TId: GenericId, TNodeTable: GenericNodeTable<TId>, TData: Send + Sync + Clone { /* fields omitted */ }

Protocol agnostic DHT service.

Its type parameters are TNodeTable - the node table implementation (see e.g. KNodeTable) and TData - stored data type.

The service starts a network listening loop in a separate thread.

Methods

impl<TId, TNodeTable, TData> Service<TId, TNodeTable, TData> where TId: GenericId, TNodeTable: GenericNodeTable<TId>, TData: Send + Sync + Clone
[src]

Create a service with a random ID.

Create a service with a given ID.

Get an immutable reference to the node table.

Get a mutable reference to the node table.

Get the current node ID.

Get an immutable reference to the data.

Get an immutable reference to the data.

Check if some buckets are full already.

Try to clean up the table by checking the oldest records.

Should be called periodically, especially when clean_needed is true.