ataraxia

package module
v0.0.0-...-237c5c3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: MIT Imports: 1 Imported by: 0

README

Ataraxia - Go

This repository contains a port of Ataraxia to Go. Nothing is really here at the moment expect some early structure and encoding/decoding.

The goal of this project is to provide a version that's fully compatible with the Node version.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct{}

type Group

type Group interface {
	// Name of the group, can be used for debugging
	Name() string

	// Join this group
	Join() error

	// Leave this group
	Leave() error

	// Broadcast a message to all nodes in this group
	Broadcast(messageType string, data interface{}) error

	Messages() chan *Message

	NotifyNodeAvailable(c chan *Node) chan *Node

	NotifyNodeUnavailable(c chan *Node) chan *Node
}

Group within the network

type Message

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

Message received from a Node in the network.

func (*Message) Bind

func (m *Message) Bind(target interface{}) error

Bind the data of this message into the given target

func (*Message) Source

func (m *Message) Source() *Node

Source of this message. Can be used to reply.

func (*Message) Type

func (m *Message) Type() string

Type of message received

type Network

type Network struct {
}

func New

func New() (*Network, error)

func (*Network) Join

func (n *Network) Join() error

func (*Network) Leave

func (n *Network) Leave() error

func (*Network) NotifyNodeAvailable

func (n *Network) NotifyNodeAvailable(c chan *Node) chan *Node

func (*Network) NotifyNodeUnavailable

func (n *Network) NotifyNodeUnavailable(c chan *Node) chan *Node

type Node

type Node struct {
}

func (*Node) Messages

func (n *Node) Messages() chan Message

Messages returns a channel that can be used to listen to all incoming data from this specific node

func (*Node) NotifyUnavailable

func (n *Node) NotifyUnavailable(c chan *Node) chan *Node

NotifyUnavailable takes a channel that will be notified when this node is no longer available in the network. When this occurs this node should be discarded - it will not be reused

func (*Node) Send

func (n *Node) Send(messageType string, data interface{}) error

Send a message of the given type to this node

type Option

type Option func(*Config) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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