View Source YaBTT.Schema.Connection (YaBTT v0.1.5)
The schema for the connections table.
A torrent can have many peers, and a peer can be connected to many torrents. This schema is used to store the primary keys as a foreign key from the torrents and peers tables.
At the same time, this table is also responsible for maintaining the status
of the link. Including uploaded',downloaded', left and event.
Link to this section Summary
Functions
A changeset to validate if the status of the connection is valid. This
torrent_id and peer_id are used to connect with the torrents and
peers tables.
Link to this section Types
Link to this section Functions
@spec changeset(changeset_t() | t(), params(), connect()) :: changeset_t()
A changeset to validate if the status of the connection is valid. This
torrent_id and peer_id are used to connect with the torrents and
peers tables.
parameters
Parameters
connection: the changeset orYaBTT.Schema.Connectionparams: the request parametersconnect: thetorrent_idandpeer_idto connect with thetorrentsandpeerstables
examples
Examples
iex> alias YaBTT.Schema.Connection
iex> params = %{"uploaded" => "121", "downloaded" => "41421", "left" => "0", "event" => "started"}
iex> Connection.changeset(%Connection{}, params, {1, 1})