Skip to content

Latest commit

 

History

History
149 lines (105 loc) · 4.79 KB

API-README.md

File metadata and controls

149 lines (105 loc) · 4.79 KB

DCDN

A rewardable DCDN node on the Ara Network

Kind: global class
Emits: info, warn, peer-update, download-progress, download-complete, request-complete

new DCDN()

Constructs a new dcdn instance

Param Type Description
opts.userId String The user's did
opts.password String The user's password
[opts.queue] Object The transaction queue

dcdN.start() ⇒ null

Start running the DCDN node in the latest configuration

Kind: instance method of DCDN
Access: public

dcdN.stop() ⇒ null

Stop running the DCDN node

Kind: instance method of DCDN
Access: public

dcdN.join() ⇒ null

Joins a hyperswarm for a given AFS and replicates for a reward. Adds the options to the node's configuration. Note: this will also start the node and load the previous configuration.

Kind: instance method of DCDN
Access: public

Param Type Description
opts.did String The did of the AFS
opts.upload boolean Whether to seed the AFS
opts.download boolean Whether to download the AFS
[opts.metaOnly] boolean Whether to only replicate the metadata
[opts.price] string Price in Ara to distribute AFS
[opts.maxPeers] int The maximum peers for the AFS
[opts.jobId] String A job id for the AFS

dcdN.unjoin() ⇒ null

Leaves a hyperswarm for a given AFS and removes its options from the node's configuration

Kind: instance method of DCDN
Access: public

Param Type Description
opts.did String The did of the AFS

"info" (message)

Informational event

Kind: event emitted by DCDN

Param Type Description
message string Helpful information about the state of the DCDN Node

"warn" (message)

Warning event

Kind: event emitted by DCDN

Param Type Description
message string Warning information about the state of the DCDN Node

"download-complete" (did)

Emitted when the download is complete and the data is ready

Kind: event emitted by DCDN

Param Type Description
did string The did of the downloaded AFS

"request-complete" (did)

Emitted when the peers have been rewarded and the job is complete

Kind: event emitted by DCDN

Param Type Description
did string The did of the downloaded AFS

"download-progress" (did, downloaded, total)

Emitted when a new data block has been downloaded

Kind: event emitted by DCDN

Param Type Description
did string The did of the AFS
downloaded int The current number of downloaded blocks
total int The total number of blocks

"peer-update" (did, count)

Emitted when a peer has been added or removed from an AFS

Kind: event emitted by DCDN

Param Type Description
did string The did of the AFS
count int The current number of peers