Package fcp :: Module node :: Class FCPNode
[hide private]
[frames] | no frames]

Class FCPNode

source code

Represents an interface to a freenet node via its FCP port, and exposes primitives for the basic genkey, get, put and putdir operations as well as peer management primitives.

Only one instance of FCPNode is needed across an entire running client application, because its methods are quite thread-safe. Creating 2 or more instances is a waste of resources.

Clients, when invoking methods, have several options regarding flow control and event notification:

Instance Methods [hide private]
 
__init__(self, **kw)
Create a connection object
source code
 
__del__(self)
object is getting cleaned up, so disconnect
source code
 
genkey(self, **kw)
Generates and returns an SSK keypair
source code
 
fcpPluginMessage(self, **kw)
Sends an FCPPluginMessage and returns FCPPluginReply message contents
source code
 
get(self, uri, **kw)
Does a direct get of a key
source code
 
put(self, uri='CHK@', **kw)
Inserts a key
source code
 
putdir(self, uri, **kw)
Inserts a freesite
source code
 
modifyconfig(self, **kw)
Modifies node configuration
source code
 
getconfig(self, **kw)
Gets node configuration
source code
 
invertprivate(self, privatekey)
Converts an SSK or USK private key to a public equivalent
source code
 
redirect(self, srcKey, destKey, **kw)
Inserts key srcKey, as a redirect to destKey.
source code
 
genchk(self, **kw)
Returns the CHK URI under which a data item would be inserted.
source code
 
listpeers(self, **kw)
Gets the list of peers from the node
source code
 
listpeernotes(self, **kw)
Gets the list of peer notes for a given peer from the node
source code
 
refstats(self, **kw)
Gets node reference and possibly node statistics.
source code
 
testDDA(self, **kw)
Test for Direct Disk Access capability on a directory (can the node and the FCP client both access the same directory?)
source code
 
addpeer(self, **kw)
Add a peer to the node
source code
 
listpeer(self, **kw)
Modify settings on one of the node's peers
source code
 
modifypeer(self, **kw)
Modify settings on one of the node's peers
source code
 
modifypeernote(self, **kw)
Modify settings on one of the node's peers
source code
 
removepeer(self, **kw)
Removes a peer from the node
source code
 
namesiteInit(self, path)
Initialise the namesites layer and load our namesites list
source code
 
namesiteLoad(self) source code
 
namesiteSave(self)
Save the namesites list
source code
 
namesiteAddLocal(self, name, privuri=None)
Create a new nameservice that we own
source code
 
namesiteDelLocal(self, name)
Delete a local nameservice
source code
 
namesiteAddRecord(self, localname, domain, uri)
Adds a (domainname -> uri) record to one of our local services
source code
 
namesiteDelRecord(self, localname, domain)
Removes a domainname record from one of our local services
source code
 
namesiteAddPeer(self, name, uri)
Adds a namesite to our list
source code
 
namesiteHasPeer(self, name)
returns True if we have a peer namesite of given name
source code
 
namesiteGetPeer(self, name)
returns record for given peer
source code
 
namesiteRemovePeer(self, name)
Removes a namesite from our list
source code
 
namesiteLookup(self, domain, **kw)
Attempts a lookup of a given 'domain name' on our designated namesites
source code
 
namesiteProcessUri(self, uri)
Reduces a URI
source code
 
listenGlobal(self, **kw)
Enable listening on global queue
source code
 
ignoreGlobal(self, **kw)
Stop listening on global queue
source code
 
purgePersistentJobs(self)
Cancels all persistent jobs in one go
source code
 
getAllJobs(self)
Returns a list of persistent jobs, excluding global jobs
source code
 
getPersistentJobs(self)
Returns a list of persistent jobs, excluding global jobs
source code
 
getGlobalJobs(self)
Returns a list of global jobs
source code
 
getTransientJobs(self)
Returns a list of non-persistent, non-global jobs
source code
 
refreshPersistentRequests(self, **kw)
Sends a ListPersistentRequests to node, to ensure that our records of persistent requests are up to date.
source code
 
clearGlobalJob(self, id)
Removes a job from the jobs queue
source code
 
getSocketTimeout(self)
Gets the socketTimeout for future socket calls; returns None if not supported by Python version
source code
 
setSocketTimeout(self, socketTimeout)
Sets the socketTimeout for future socket calls
source code
 
getVerbosity(self)
Gets the verbosity for future logging calls
source code
 
setVerbosity(self, verbosity)
Sets the verbosity for future logging calls
source code
 
shutdown(self)
Terminates the manager thread
source code
 
_mgrThread(self)
This thread is the nucleus of pyFreenet, and coordinates incoming client commands and incoming node responses
source code
 
_msgIncoming(self)
Returns True if a message is coming in from the node
source code
 
_submitCmd(self, id, cmd, **kw)
Submits a command for execution
source code
 
_on_clientReq(self, job)
takes an incoming request job from client and transmits it to the fcp port, and also registers it so the manager thread can action responses from the fcp port.
source code
 
_on_rxMsg(self, msg)
Handles incoming messages from node
source code
 
_hello(self)
perform the initial FCP protocol handshake
source code
 
_parseCompressionCodecs(self, CompressionCodecsString)
Turn the CompressionCodecsString returned by the node into a list of name and number of the codec.
source code
 
defaultCompressionCodecsString(self)
Turn the CompressionCodecs into a string accepted by the node.
source code
 
_getUniqueId(self)
Allocate a unique ID for a request
source code
 
_txMsg(self, msgType, **kw)
low level message send
source code
 
_rxMsg(self)
Receives and returns a message as a dict
source code
 
_log(self, level, msg)
Logs a message.
source code
Class Variables [hide private]
  svnLongRevision = '$Revision$'
  svnRevision = ''
  noCloseSocket = True
  nodeIsAlive = False
  nodeVersion = None
hash(x)
  nodeFCPVersion = None
hash(x)
  nodeBuild = None
hash(x)
  nodeRevision = None
hash(x)
  nodeExtBuild = None
hash(x)
  nodeExtRevision = None
hash(x)
  nodeIsTestnet = None
hash(x)
  compressionCodecs = [('GZIP', 0), ('BZIP2', 1), ('LZMA', 2)]
Instance Variables [hide private]
  connectionidentifier
The id for the connection
Method Details [hide private]

__init__(self, **kw)
(Constructor)

source code 

Create a connection object

Keyword Arguments:

  • name - name of client to use with reqs, defaults to random. This is crucial if you plan on making persistent requests
  • host - hostname, defaults to environment variable FCP_HOST, and if this doesn't exist, then defaultFCPHost
  • port - port number, defaults to environment variable FCP_PORT, and if this doesn't exist, then defaultFCPPort
  • logfile - a pathname or writable file object, to which log messages should be written, defaults to stdout unless logfunc is specified
  • logfunc - a function to which log messages should be written or None for no such function should be used, defaults to None
  • verbosity - how detailed the log messages should be, defaults to 0 (silence)
  • socketTimeout - value to pass to socket object's settimeout() if available and the value is not None, defaults to None

Attributes of interest:

  • jobs - a dict of currently running jobs (persistent and nonpersistent). keys are job ids and values are JobTicket objects

Notes:

  • when the connection is created, a 'hello' handshake takes place. After that handshake, the node sends back a list of outstanding persistent requests left over from the last connection (based on the value of the 'name' keyword passed into this constructor).

    This object then wraps all this info into JobTicket instances and stores them in the self.persistentJobs dict

genkey(self, **kw)

source code 

Generates and returns an SSK keypair

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • usk - default False - if True, returns USK uris
  • name - the path to put at end, optional

fcpPluginMessage(self, **kw)

source code 

Sends an FCPPluginMessage and returns FCPPluginReply message contents

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • plugin_name - A name to identify the plugin. The same as class name shown on plugins page.
  • plugin_params - a dict() containing the key-value pairs to be sent to the plugin as parameters

get(self, uri, **kw)

source code 

Does a direct get of a key

Keywords:

  • async - whether to return immediately with a job ticket object, default False (wait for completion)
  • persistence - default 'connection' - the kind of persistence for this request. If 'reboot' or 'forever', this job will be able to be recalled in subsequent FCP sessions. Other valid values are 'reboot' and 'forever', as per FCP spec
  • Global - default false - if evaluates to true, puts this request on the global queue. Note the capital G in Global. If you set this, persistence must be 'reboot' or 'forever'
  • Verbosity - default 0 - sets the Verbosity mask passed in the FCP message - case-sensitive
  • priority - the PriorityClass for retrieval, default 2, may be between 0 (highest) to 6 (lowest)
  • dsnly - whether to only check local datastore
  • ignoreds - don't check local datastore
  • file - if given, this is a pathname to which to store the retrieved key
  • followRedirect - follow a redirect if true, otherwise fail the get
  • nodata - if true, no data will be returned. This can be a useful test of whether a key is retrievable, without having to consume resources by retrieving it
  • stream - if given, this is a writeable file object, to which the received data should be written a chunk at a time
  • timeout - timeout for completion, in seconds, default one year

Returns a 3-tuple, depending on keyword args:

  • if 'file' is given, returns (mimetype, pathname) if key is returned
  • if 'file' is not given, returns (mimetype, data, msg) if key is returned
  • if 'nodata' is true, returns (mimetype, 1) if key is returned
  • if 'stream' is given, returns (mimetype, None) if key is returned, because all the data will have been written to the stream

If key is not found, raises an exception

put(self, uri='CHK@', **kw)

source code 

Inserts a key

Arguments:

  • uri - uri under which to insert the key

Keywords - you must specify one of the following to choose an insert mode:

  • file - path of file from which to read the key data
  • data - the raw data of the key as string
  • dir - the directory to insert, for freesite insertion
  • redirect - the target URI to redirect to

Keywords for 'file' mode:

  • name - human-readable target filename - default is taken from URI

Keywords for 'dir' mode:

  • name - name of the freesite, the 'sitename' in SSK@privkey/sitename'
  • usk - whether to insert as a USK (USK@privkey/sitename/version/), default False
  • version - valid if usk is true, default 0

Keywords for 'file' and 'data' modes:

  • chkonly - only generate CHK, don't insert - default false
  • dontcompress - do not compress on insert - default false

Keywords for 'file', 'data' and 'redirect' modes:

  • mimetype - the mime type, default text/plain

Keywords valid for all modes:

  • async - whether to do the job asynchronously, returning a job ticket object (default False)
  • waituntilsent - default False, if True, and if async=True, waits until the command has been sent to the node before returning a job object
  • persistence - default 'connection' - the kind of persistence for this request. If 'reboot' or 'forever', this job will be able to be recalled in subsequent FCP sessions. Other valid values are 'reboot' and 'forever', as per FCP spec
  • Global - default false - if evaluates to true, puts this request on the global queue. Note the capital G in Global. If you set this, persistence must be 'reboot' or 'forever'
  • Verbosity - default 0 - sets the Verbosity mask passed in the FCP message - case-sensitive
  • maxretries - maximum number of retries, default 3
  • priority - the PriorityClass for retrieval, default 3, may be between 0 (highest) to 6 (lowest)
  • realtime true/false - sets the RealTimeRequest flag.
  • timeout - timeout for completion, in seconds, default one year

Notes:

  • exactly one of 'file', 'data' or 'dir' keyword arguments must be present

putdir(self, uri, **kw)

source code 

Inserts a freesite

Arguments:

  • uri - uri under which to insert the key

Keywords:

  • dir - the directory to insert - mandatory, no default. This directory must contain a toplevel index.html file
  • name - the name of the freesite, defaults to 'freesite'
  • usk - set to True to insert as USK (Default false)
  • version - the USK version number, default 0
  • filebyfile - default False - if True, manually inserts each constituent file, then performs the ClientPutComplexDir as a manifest full of redirects. You *must* use this mode if inserting from across a LAN
  • maxretries - maximum number of retries, default 3
  • priority - the PriorityClass for retrieval, default 2, may be between 0 (highest) to 6 (lowest)
  • id - the job identifier, for persistent requests
  • async - default False - if True, return immediately with a job ticket
  • persistence - default 'connection' - the kind of persistence for this request. If 'reboot' or 'forever', this job will be able to be recalled in subsequent FCP sessions. Other valid values are 'reboot' and 'forever', as per FCP spec
  • Global - default false - if evaluates to true, puts this request on the global queue. Note the capital G in Global. If you set this, persistence must be 'reboot' or 'forever'
  • Verbosity - default 0 - sets the Verbosity mask passed in the FCP message - case-sensitive
  • allatonce - default False - if set, and if filebyfile is set, then all files of the site will be inserted simultaneously, which can give a nice speed-up for small to moderate sites, but cruel choking on large sites; use with care
  • globalqueue - perform the inserts on the global queue, which will survive node reboots
  • timeout - timeout for completion, in seconds, default one year

Returns:

  • the URI under which the freesite can be retrieved

modifyconfig(self, **kw)

source code 

Modifies node configuration

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • keywords, which are the same as for the FCP message and documented in the wiki: http://wiki.freenetproject.org/FCP2p0ModifyConfig

getconfig(self, **kw)

source code 

Gets node configuration

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • WithCurrent - default False - if True, the current configuration settings will be returned in the "current" tree of the ConfigData message fieldset
  • WithShortDescription - default False - if True, the configuration setting short descriptions will be returned in the "shortDescription" tree of the ConfigData message fieldset
  • other keywords, which are the same as for the FCP message and documented in the wiki: http://wiki.freenetproject.org/FCP2p0GetConfig

redirect(self, srcKey, destKey, **kw)

source code 

Inserts key srcKey, as a redirect to destKey. srcKey must be a KSK, or a path-less SSK or USK (and not a CHK)

genchk(self, **kw)

source code 

Returns the CHK URI under which a data item would be inserted.

Keywords - you must specify one of the following:

  • file - path of file from which to read the key data
  • data - the raw data of the key as string

Keywords - optional:

  • mimetype - defaults to text/plain - THIS AFFECTS THE CHK!!

listpeers(self, **kw)

source code 

Gets the list of peers from the node

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • WithMetadata - default False - if True, returns a peer's metadata
  • WithVolatile - default False - if True, returns a peer's volatile info

listpeernotes(self, **kw)

source code 

Gets the list of peer notes for a given peer from the node

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • NodeIdentifier - one of name, identity or IP:port for the desired peer

refstats(self, **kw)

source code 

Gets node reference and possibly node statistics.

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • GiveOpennetRef - default False - if True, return the node's Opennet reference rather than the node's Darknet reference
  • WithPrivate - default False - if True, includes the node's private node reference fields
  • WithVolatile - default False - if True, returns a node's volatile info

testDDA(self, **kw)

source code 

Test for Direct Disk Access capability on a directory (can the node and the FCP client both access the same directory?)

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • Directory - directory to test
  • WithReadDirectory - default False - if True, want node to read from directory for a put operation
  • WithWriteDirectory - default False - if True, want node to write to directory for a get operation

addpeer(self, **kw)

source code 

Add a peer to the node

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • File - filepath of a file containing a noderef in the node's directory
  • URL - URL of a copy of a peer's noderef to add
  • kwdict - If neither File nor URL are provided, the fields of a noderef can be passed in the form of a Python dictionary using the kwdict keyword

listpeer(self, **kw)

source code 

Modify settings on one of the node's peers

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • NodeIdentifier - one of name (except for opennet peers), identity or IP:port for the desired peer

modifypeer(self, **kw)

source code 

Modify settings on one of the node's peers

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • IsDisabled - default False - enables or disabled the peer accordingly
  • IsListenOnly - default False - sets ListenOnly on the peer
  • NodeIdentifier - one of name, identity or IP:port for the desired peer

modifypeernote(self, **kw)

source code 

Modify settings on one of the node's peers

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • NodeIdentifier - one of name, identity or IP:port for the desired peer
  • NoteText - base64 encoded string of the desired peer note text
  • PeerNoteType - code number of peer note type: currently only private peer note is supported by the node with code number 1

removepeer(self, **kw)

source code 

Removes a peer from the node

Keywords:

  • async - whether to do this call asynchronously, and return a JobTicket object
  • callback - if given, this should be a callable which accepts 2 arguments:
    • status - will be one of 'successful', 'failed' or 'pending'
    • value - depends on status:
      • if status is 'successful', this will contain the value returned from the command
      • if status is 'failed' or 'pending', this will contain a dict containing the response from node
  • NodeIdentifier - one of name, identity or IP:port for the desired peer

namesiteLookup(self, domain, **kw)

source code 

Attempts a lookup of a given 'domain name' on our designated namesites

Arguments:

  • domain - the domain to look up

Keywords:

  • localonly - whether to only search local cache
  • peer - if given, search only that peer's namesite (not locals)

refreshPersistentRequests(self, **kw)

source code 

Sends a ListPersistentRequests to node, to ensure that our records of persistent requests are up to date.

Since, upon connection, the node sends us a list of all outstanding persistent requests anyway, I can't really see much use for this method. I've only added the method for FCP spec compliance

setSocketTimeout(self, socketTimeout)

source code 

Sets the socketTimeout for future socket calls

>>> node = FCPNode()
>>> timeout = node.getSocketTimeout()
>>> newtimeout = 1800
>>> node.setSocketTimeout(newtimeout)
>>> node.getSocketTimeout()
1800.0

getVerbosity(self)

source code 

Gets the verbosity for future logging calls

>>> node = FCPNode()
>>> node.getVerbosity() # default
3
>>> node.setVerbosity(INFO)
>>> node.getVerbosity()
4

shutdown(self)

source code 

Terminates the manager thread

You should explicitly shutdown any existing nodes before exiting your client application

_submitCmd(self, id, cmd, **kw)

source code 

Submits a command for execution

Arguments:

  • id - the command identifier
  • cmd - the command name, such as 'ClientPut'

Keywords:

  • async - whether to return a JobTicket object, rather than the command result
  • callback - a function taking 2 args 'status' and 'value'. Status is one of 'successful', 'pending' or 'failed'. value is the primitive return value if successful, or the raw node message if pending or failed
  • followRedirect - follow a redirect if true, otherwise fail the get
  • rawcmd - a raw command buffer to send directly
  • options specific to command such as 'URI'
  • timeout - timeout in seconds for job completion, default 1 year
  • waituntilsent - whether to block until this command has been sent to the node, default False
  • keep - whether to keep the job on our jobs list after it completes, default False

Returns:

  • if command is sent in sync mode, returns the result
  • if command is sent in async mode, returns a JobTicket object which the client can poll or block on later
>>> import fcp
>>> n = fcp.node.FCPNode()
>>> cmd = "ClientPut"
>>> jobid = "id2291160822224650"
>>> opts = {'Metadata.ContentType': 'text/html', 'async': False, 'UploadFrom': 'direct', 'Verbosity': 0, 'Global': 'false', 'URI': 'CHK@', 'keep': False, 'DontCompress': 'false', 'MaxRetries': -1, 'timeout': 31536000, 'Codecs': 'GZIP, BZIP2, LZMA, LZMA_NEW', 'GetCHKOnly': 'true', 'RealTimeFlag': 'false', 'waituntilsent': False, 'Identifier': jobid, 'Data': '<!DOCTYPE html>\n<html>\n<head>\n<title>Sitemap for freenet-plugin-bare</title>\n</head>\n<body>\n<h1>Sitemap for freenet-plugin-bare</h1>\nThis listing was automatically generated and inserted by freesitemgr\n<br><br>\n<table cellspacing=0 cellpadding=2 border=0>\n<tr>\n<td><b>Size</b></td>\n<td><b>Mimetype</b></td>\n<td><b>Name</b></td>\n</tr>\n<tr>\n<td>19211</td>\n<td>text/html</td>\n<td><a href="index.html">index.html</a></td>\n</tr>\n</table>\n<h2>Keys of large, separately inserted files</h2>\n<pre>\n</pre></body></html>\n', 'PriorityClass': 3, 'Persistence': 'connection', 'TargetFilename': 'sitemap.html'}
>>> n._submitCmd(jobid, cmd, **opts)
'CHK@FR~anQPhpw7lZjxl96o1b875tem~5xExPTiSa6K3Wus,yuGOWhpqFY5N9i~N4BjM0Oh6Bk~Kkb7sE4l8GAsdBEs,AAMC--8/sitemap.html'
>>> # n._submitCmd(id=None, cmd='WatchGlobal', **{'Enabled': 'true'})

_on_rxMsg(self, msg)

source code 

Handles incoming messages from node

If an incoming message represents the termination of a command, the job ticket object will be notified accordingly

_parseCompressionCodecs(self, CompressionCodecsString)

source code 

Turn the CompressionCodecsString returned by the node into a list of name and number of the codec.

Parameters:
  • CompressionCodecsString - "3 - GZIP(0), BZIP2(1), LZMA(2)"
Returns:
[(name, number), ...]

defaultCompressionCodecsString(self)

source code 

Turn the CompressionCodecs into a string accepted by the node.

Parameters:
  • CompressionCodecs - [(name, number), ...]
Returns:
"GZIP, BZIP2, LZMA" (example)

_txMsg(self, msgType, **kw)

source code 

low level message send

Arguments:

  • msgType - one of the FCP message headers, such as 'ClientHello'
  • args - zero or more (keyword, value) tuples

Keywords:

  • rawcmd - if given, this is the raw buffer to send
  • other keywords depend on the value of msgType

_rxMsg(self)

source code 

Receives and returns a message as a dict

The header keyword is included as key 'header'

_log(self, level, msg)

source code 

Logs a message. If level > verbosity, don't output it