Dee.Peer

g Dee.Peer Dee.Peer GObject.Object GObject.Object GObject.Object->Dee.Peer

Subclasses:

Dee.Client, Dee.Server

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (swarm_name)

get_connections ()

get_swarm_leader ()

get_swarm_name ()

is_swarm_leader ()

is_swarm_owner ()

list_peers ()

Virtual Methods

Inherited:

GObject.Object (7)

do_connection_acquired (connection)

do_connection_closed (connection)

do_get_connections ()

do_get_swarm_leader ()

do_is_swarm_leader ()

do_list_peers ()

do_peer_found (name)

do_peer_lost (name)

Properties

Name

Type

Flags

Short Description

swarm-leader

str

r

Unique DBus address of the swarm leader

swarm-name

str

r/w/c

Well-known name to find other peers with

swarm-owner

bool

r/w/co

Try to assume leadership of the swarm

Signals

Inherited:

GObject.Object (1)

Name

Short Description

connection-acquired

connection-closed

Connect to this signal to be notified when peers close their Gio.DBusConnection.

peer-found

Connect to this signal to be notified of existing and new peers that are in your swarm.

peer-lost

Connect to this signal to be notified when peers disconnect from the swarm

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

priv

Dee.PeerPrivate

r

Class Details

class Dee.Peer(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Dee.PeerClass

All fields in the Dee.Peer structure are private and should never be accessed directly

classmethod new(swarm_name)
Parameters:

swarm_name (str) – The name of the swarm to join. Fx “org.example.DataProviders”

Returns:

A newly constructed Dee.Peer. Free with GObject.Object.unref().

Return type:

Dee.Peer

Create a new Dee.Peer. The peer will immediately connect to the swarm and start the peer discovery.

get_connections()
Returns:

List of connections.

Return type:

[Gio.DBusConnection]

Gets list of Gio.DBusConnection instances used by this Dee.Peer instance.

get_swarm_leader()
Returns:

Unique DBus address of the current swarm leader, possibly None if the leader has not been detected yet

Return type:

str

In case this peer is connected to a message bus, gets the unique DBus address of the current swarm leader, otherwise returns id of the leader.

get_swarm_name()
Returns:

The swarm name

Return type:

str

Gets the unique name for this swarm. The swarm leader is the Peer owning this name on the session bus.

is_swarm_leader()
Returns:

True if and only if this peer owns the swarm name on the session bus

Return type:

bool

is_swarm_owner()
Returns:

True if the :swarm-owner property was set during construction.

Return type:

bool

Gets the value of the :swarm-owner property.

Note that this does NOT mean that the peer is leader of the swarm! Check also Dee.Peer.is_swarm_leader().

list_peers()
Returns:

List of peers (free using GLib.strfreev()).

Return type:

[str]

Gets list of all peers currently in this swarm.

do_connection_acquired(connection) virtual
Parameters:

connection (Gio.DBusConnection) –

do_connection_closed(connection) virtual
Parameters:

connection (Gio.DBusConnection) –

do_get_connections() virtual
Returns:

List of connections.

Return type:

[Gio.DBusConnection]

Gets list of Gio.DBusConnection instances used by this Dee.Peer instance.

do_get_swarm_leader() virtual
Returns:

Unique DBus address of the current swarm leader, possibly None if the leader has not been detected yet

Return type:

str

In case this peer is connected to a message bus, gets the unique DBus address of the current swarm leader, otherwise returns id of the leader.

do_is_swarm_leader() virtual
Returns:

True if and only if this peer owns the swarm name on the session bus

Return type:

bool

do_list_peers() virtual
Returns:

List of peers (free using GLib.strfreev()).

Return type:

[str]

Gets list of all peers currently in this swarm.

do_peer_found(name) virtual
Parameters:

name (str) –

do_peer_lost(name) virtual
Parameters:

name (str) –

Signal Details

Dee.Peer.signals.connection_acquired(peer, object)
Signal Name:

connection-acquired

Flags:

RUN_LAST

Parameters:
Dee.Peer.signals.connection_closed(peer, connection)
Signal Name:

connection-closed

Flags:

RUN_LAST

Parameters:

Connect to this signal to be notified when peers close their Gio.DBusConnection.

Dee.Peer.signals.peer_found(peer, name)
Signal Name:

peer-found

Flags:

RUN_LAST

Parameters:
  • peer (Dee.Peer) – The object which received the signal

  • name (str) – the DBus name of the object found

Connect to this signal to be notified of existing and new peers that are in your swarm.

Dee.Peer.signals.peer_lost(peer, name)
Signal Name:

peer-lost

Flags:

RUN_LAST

Parameters:
  • peer (Dee.Peer) – The object which received the signal

  • name (str) – the DBus name of the object that disconnected

Connect to this signal to be notified when peers disconnect from the swarm

Property Details

Dee.Peer.props.swarm_leader
Name:

swarm-leader

Type:

str

Default Value:

None

Flags:

READABLE

Unique DBus address of the swarm leader

Dee.Peer.props.swarm_name
Name:

swarm-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

Well-known name to find other peers with

Dee.Peer.props.swarm_owner
Name:

swarm-owner

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Try to assume leadership of the swarm