View Source YaBTT.Query.State (YaBTT v0.1.5)
This module is used to query the state from the YaBTT.Schema.Connection
.
Link to this section Summary
Functions
Query the statistics of the tracker from the YaBTT.Schema.Connection
.
Query the state with info_hash/0
from the YaBTT.Schema.Connection
.
Link to this section Types
@type info_hash() :: binary()
@type t() :: %{ required(binary()) => %{ required(info_hash()) => %{required(binary()) => non_neg_integer()} | %{} } }
Link to this section Functions
@spec query() :: map()
Query the statistics of the tracker from the YaBTT.Schema.Connection
.
The following information will be queried:
active
- The number of active connections.seeders
- The number of active connections that have completed downloading.leechers
- The number of active connections that have not completed downloading.completed
- The number of connections that have ever completed downloading.total
- The total number of connections.torrents
- The total number of torrents.peers
- The total number of peers.
Then we will return a key-value map and the value will be a non-negative integer.
examples
Examples
iex> YaBTT.Query.State.query()
Query the state with info_hash/0
from the YaBTT.Schema.Connection
.
Use one or more given info_hash/0
to query the following information
from the YaBTT.Schema.Connection
:
complete
- The number of active peers that have completed downloading.incomplete
- The number of active peers that have not completed downloading.downloaded
- The number of peers that have ever completed downloading.
Then we will return a t/0
as required by the specification.
references
References
examples
Examples
iex> YaBTT.Query.State.query(["info_hash_1", "info_hash_2"])