pastry

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2014 License: GPL-3.0-or-later Imports: 21 Imported by: 0

Documentation

Overview

Package pastry contains a simplified version of Pastry, where proximity is not taken into consideration (i.e. no neighbor set).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance

func Distance(a, b *big.Int) *big.Int

Calculates the absolute distance between two ids on the circular ID space

func Resolve

func Resolve(id string) *big.Int

Converts a string id into an overlay id.

Types

type Callback

type Callback interface {
	Deliver(msg *proto.Message, key *big.Int)
	Forward(msg *proto.Message, key *big.Int) bool
}

Callback for events leaving the overlay network.

type Overlay

type Overlay struct {
	// contains filtered or unexported fields
}

Internal structure for the overlay state information.

func New

func New(id string, key *rsa.PrivateKey, app Callback) *Overlay

Creates a new overlay structure with all internal state initialized, ready to be booted.

func (*Overlay) Boot

func (o *Overlay) Boot() (int, error)

Boots the overlay network: it starts up boostrappers and connection acceptors on all local IPv4 interfaces, after which the overlay management is booted. The method returns the number of remote peers after convergence is reached.

func (*Overlay) Self

func (o *Overlay) Self() *big.Int

Returns the overlay node's identifier.

func (*Overlay) Send

func (o *Overlay) Send(dest *big.Int, msg *proto.Message)

Sends a message to the closest node to the given destination.

func (*Overlay) Shutdown

func (o *Overlay) Shutdown() error

Sends a termination signal to all the go routines part of the overlay.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL