polyswarmclient.events

Module Contents

polyswarmclient.events.logger[source]
class polyswarmclient.events.Callback[source]

Bases: object

Abstract callback class which is the parent to a number of child callback classes to be used in different scenarios.

Note

Classes which extend Callback are expected to impliment the run method.

register(self, f)[source]

Register a function to this Callback.

Parameters

f (function) – Function to register.

remove(self, f)[source]

Remove a function previously assigned to this Callback.

Parameters

f (function) – Function to remove.

class polyswarmclient.events.OnRunCallback[source]

Bases: polyswarmclient.events.Callback

Called upon entering the event loop for the first time, use for initialization

class polyswarmclient.events.OnNewBlockCallback[source]

Bases: polyswarmclient.events.Callback

Called upon receiving a new block, scheduled events triggered separately

class polyswarmclient.events.OnNewBountyCallback[source]

Bases: polyswarmclient.events.Callback

Called upon receiving a new bounty

class polyswarmclient.events.OnNewAssertionCallback[source]

Bases: polyswarmclient.events.Callback

Called upon receiving a new assertion

class polyswarmclient.events.OnRevealAssertionCallback[source]

Bases: polyswarmclient.events.Callback

Called upon receiving a new assertion reveal

class polyswarmclient.events.OnNewVoteCallback[source]

Bases: polyswarmclient.events.Callback

Called upon receiving a new arbiter vote

class polyswarmclient.events.OnQuorumReachedCallback[source]

Bases: polyswarmclient.events.Callback

Called upon a bounty reaching quorum

class polyswarmclient.events.OnSettledBountyCallback[source]

Bases: polyswarmclient.events.Callback

Called upon a bounty being settled

class polyswarmclient.events.OnInitializedChannelCallback[source]

Bases: polyswarmclient.events.Callback

Called upon a channel being initialized

class polyswarmclient.events.Schedule[source]

Bases: object

Generic Schedule class. Uses a PriorityQueue data structure to store Events.

empty(self)[source]

Return True if the queue is empty.

Returns

Is the queue empty.

Return type

boolean

peek(self)[source]

Return True if the queue is empty.

Returns

Tuple at the front of the queue if the queue is full, else None.

Return type

(block, event)

get(self)[source]

Pop the lowest valued block in the queue.

Returns

The lowest valued block in the PriorityQueue.

Return type

(block, event)

put(self, block, event)[source]

Add a tuple (block, event) to the PriorityQueue. Block signifies the priority of the event.

class polyswarmclient.events.Event(guid)[source]

Bases: object

Generic Event class. Stores GUID and can compare for equality and order Events.

Parameters

guid (str) – GUID of the event.

__eq__(self, other)[source]
__lt__(self, other)[source]
class polyswarmclient.events.RevealAssertion(guid, index, nonce, verdicts, metadata)[source]

Bases: polyswarmclient.events.Event

An assertion scheduled to be publically revealed

Parameters
  • guid (str) – GUID of the bounty being asserted on

  • index (int) – Index of the assertion to reveal

  • nonce (str) – Secret nonce used to reveal assertion

  • verdicts (List[bool]) – List of verdicts for each artifact in the bounty

  • metadata (str) – Optional metadata

class polyswarmclient.events.OnRevealAssertionDueCallback[source]

Bases: polyswarmclient.events.Callback

Called when an assertion is needing to be revealed

class polyswarmclient.events.VoteOnBounty(guid, votes, valid_bloom)[source]

Bases: polyswarmclient.events.Event

A scheduled vote from an arbiter :param guid: GUID of the bounty being voted on :type guid: str :param votes: List of votes for each artifact in the bounty :type votes: List[bool] :param valid_bloom: Is the bloom filter submitted with the bounty valid :type valid_bloom: bool

class polyswarmclient.events.OnVoteOnBountyDueCallback[source]

Bases: polyswarmclient.events.Callback

Called when a bounty is needing to be voted on

class polyswarmclient.events.SettleBounty(guid)[source]

Bases: polyswarmclient.events.Event

A bounty scheduled to be settled :param guid: GUID of the bounty being asserted on :type guid: str

class polyswarmclient.events.OnSettleBountyDueCallback[source]

Bases: polyswarmclient.events.Callback

Called when a bounty is needing to be settled