Module swirl

Library for PPSPP over UDP, aka Swift protocol.

Description

Wrapper to support running directly from escript.

Function Index

help/0help for console users Provides a summary of available commands options within the erlang console.
main/1
quit/0Stop the swirl application, all dependent swarms and peers, and the entire BEAM virtual machine too.
start/0Start the swirl application in a stand-alone fashion.
start/1Start the swirl application and everything ready to peer.
start_channel/2start a PPSPP channel, using the supplied peer info and swarm.
start_peer/0start a PPSPP listener (peer) on a given port, or the default port, using the supplied hash and default PPSPP swarm options, or no hash at all for an inert peer that can subsequently be controlled by multiple swarms.
start_peer/1
start_peer/2
start_pool/2start multiple PPSPP listeners (peers) quickly on a given range of ports.
start_swarm/1start a PPSPP swarm, using the supplied hash and PPSPP swarm options.
stop/0Stop the swirl application and all dependent swarms and peers.
stop_channel/1stop a PPSPP channel.
stop_peer/0stop a PPSPP peer on a given port, or the default port.
stop_peer/1
stop_pool/2stop multiple PPSPP peers on a given range of ports.
stop_swarm/1stop a PPSPP swarm for a given root_hash or swarm_id.

Function Details

help/0


help() -> ok

help for console users Provides a summary of available commands options within the erlang console

main/1


main(X1 :: any()) -> no_return()

quit/0


quit() -> no_return()

Stop the swirl application, all dependent swarms and peers, and the entire BEAM virtual machine too.

start/0


start() -> ok

Start the swirl application in a stand-alone fashion. This should only be used for testing and in the erlang shell.

start/1


start(Swarm_id ::string() |ppspp_options:swarm_id() |ppspp_options:options()) ->{ok, pid(), pid(), inet:port_number(), string()}

Start the swirl application and everything ready to peer. Takes either single swarm_id as string or binary and assumes PPSPP defaults, or a full set of PPSPP options including the swarm_id. It starts a swarm and peer, and returns the URI for connecting to.

start_channel/2


start_channel(Peer_endpoint :: ppspp_datagram:endpoint(),Swarm_options :: ppspp_options:options()) ->{ok, pid()} | {error, term()}

start a PPSPP channel, using the supplied peer info and swarm.

start_peer/0


start_peer() -> {ok, pid()} | {error, term()}

start a PPSPP listener (peer) on a given port, or the default port, using the supplied hash and default PPSPP swarm options, or no hash at all for an inert peer that can subsequently be controlled by multiple swarms.

start_peer/1


start_peer(Swarm_id :: string() | ppspp_options:swarm_id()) ->{ok, pid()} | {error, term()}

start_peer/2


start_peer(Port :: inet:port_number(),Swarm_Options :: ppspp_options:options()) ->{ok, pid()} | {error, term()}

start_pool/2


start_pool(First :: inet:port_number(),Last :: inet:port_number()) ->[{{ok, pid()}, inet:port_number() | {error, term()}}]

start multiple PPSPP listeners (peers) quickly on a given range of ports. Note there is no guarantee of success nor error checking but it looks great for demos.

start_swarm/1


start_swarm(Swarm_id ::string() |ppspp_options:swarm_id() |ppspp_options:options()) ->{ok, pid()} | {error, term()}

start a PPSPP swarm, using the supplied hash and PPSPP swarm options. If either a string (root hash), or a binary (swarm id) are supplied, then start_swarm will do the right thing and assume default PPSPP options. Note that the hashing algorithm and chunk size must match for this to work. – caveat coder

stop/0


stop() -> ok | {error, term()}

Stop the swirl application and all dependent swarms and peers. Allows swirl to terminate any peer connections if necessary. end

stop_channel/1


stop_channel(Channel :: ppspp_channel:channel()) ->ok | {error, any()}

stop a PPSPP channel

stop_peer/0


stop_peer() -> ok | {error, ppspp_peer_worker_not_found}

stop a PPSPP peer on a given port, or the default port.

stop_peer/1


stop_peer(Port :: inet:port_number()) ->ok | {error, ppspp_peer_worker_not_found}

stop_pool/2


stop_pool(First :: inet:port_number(), Last :: inet:port_number()) ->[{ok | {error, term()}, inet:port_number()}]

stop multiple PPSPP peers on a given range of ports.

stop_swarm/1


stop_swarm(Swarm :: string() | ppspp_options:swarm_id()) ->ok | {error, ppspp_swarm_worker_not_found}

stop a PPSPP swarm for a given root_hash or swarm_id.