tissue

package
v0.0.0-...-fd2add7 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package tissue is an efficient “social” protocol for maintaining mutual awareness and sharing resources amongs circuit workers.

Index

Constants

View Source
const (
	// Expansion is the number of peers that each circuit worker is continuously connected to
	// for the purposes of dynamically maintaining node presence using the tissue
	// collaborative protocol.
	ExpansionLow  = 7
	ExpansionHigh = 11
	Spread        = 5

	// Depth is the number of random walk steps taken when sampling for a random circuit worker.
	Depth = 3 * 2 // Lazy random walk with stay-put probability one half
)
View Source
const ServiceName = "kin"

Variables

This section is empty.

Functions

func ForwardPanic

func ForwardPanic(x circuit.PermX, fwd func(recov interface{})) circuit.PermX

ForwardPanic replaces the cross-interface x with one that captures panics during method calls and passes them to the fwd func in a separate goroutine, while also propagating the original panic through the stack.

func NewKin

func NewKin() (k *Kin, xkin XKin, rip <-chan KinAvatar)

Types

type Avatar

type Avatar struct {
	X  circuit.PermX
	ID lang.ReceiverID
}

Avatar is a pair of a permanent cross-interface and an ID, identifying its underlying receiver uniquely.

func ForwardAvatarPanic

func ForwardAvatarPanic(av Avatar, fwd func(recov interface{})) Avatar

ForwardAvatarPanic is like ForwardPanic but for Avatar objects.

func (Avatar) Equals

func (av Avatar) Equals(w Avatar) bool

func (Avatar) IsNil

func (av Avatar) IsNil() bool

IsNil returns true if the Avatar is not set.

func (Avatar) String

func (av Avatar) String() string

String returns a textual form of the Avatar.

type Folk

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

func (*Folk) Opened

func (folk *Folk) Opened() []FolkAvatar

func (*Folk) Replenish

func (folk *Folk) Replenish() (peer FolkAvatar)

Replenish blocks and returns the next downstream peer added to the neighborhod set by the kin.

type FolkAvatar

type FolkAvatar Avatar

FolkAvatar is an Avatar underlied by a user receiver for a service shared over the tissue system.

func (FolkAvatar) Avatar

func (av FolkAvatar) Avatar() Avatar

func (FolkAvatar) String

func (av FolkAvatar) String() string

type Kin

type Kin struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Kin is a service that maintains connectivity to a small set of 'neighbor' circuits.

func (*Kin) Attach

func (k *Kin) Attach(topic string, folkAvatar FolkAvatar) *Folk

func (*Kin) Avatar

func (k *Kin) Avatar() KinAvatar

func (*Kin) ReJoin

func (k *Kin) ReJoin(join n.Addr) (err error)

ReJoin contacts the peering service at the circuit worker with address join and joins into its circuit network.

type KinAvatar

type KinAvatar Avatar

KinAvatar is an Avatar specifically for the XKin receiver.

func (KinAvatar) String

func (av KinAvatar) String() string

type Neighborhood

type Neighborhood struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Neighborhood is a set of perm cross-interfaces.

func NewNeighborhood

func NewNeighborhood() *Neighborhood

NewNeighborhood creates a new rotor.

func (*Neighborhood) Add

func (nh *Neighborhood) Add(av Avatar)

func (*Neighborhood) Choose

func (nh *Neighborhood) Choose() Avatar

Choose returns a randomly chosen Avatar.

func (*Neighborhood) Len

func (nh *Neighborhood) Len() int

Len returns the number of Avatars in the rotor.

func (*Neighborhood) Scrub

func (nh *Neighborhood) Scrub(key lang.ReceiverID) (Avatar, bool)

func (*Neighborhood) ScrubRandom

func (nh *Neighborhood) ScrubRandom() (Avatar, bool)

func (*Neighborhood) View

func (nh *Neighborhood) View() []Avatar

View returns a list of all Avatars in the rotor.

type XKin

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

XKin is the cross-worker interface of the tissue system at this circuit.

func (XKin) Attach

func (x XKin) Attach(topic string) FolkAvatar

Attach returns a cross-reference to a folk service at this worker.

func (XKin) Join

func (x XKin) Join(boundary []KinAvatar, spread int) []KinAvatar

Join accepts calls from other peers who want to join the network of this one.

func (XKin) Walk

func (x XKin) Walk(t int) KinAvatar

Walk performs a random walk through the expander-graph network of circuit workers of length t steps and returns the terminal node.

type YKin

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

YKin

func (YKin) Attach

func (y YKin) Attach(topic string) FolkAvatar

func (YKin) Join

func (y YKin) Join(boundary []KinAvatar, n int) []KinAvatar

func (YKin) Walk

func (y YKin) Walk(t int) KinAvatar

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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