quasar

package module
v0.0.0-...-97a3666 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2017 License: MIT Imports: 16 Imported by: 0

README

Build Status Issues Go Report Card License GoDoc Donate PayPal Donate Bitcoin Avaivable For Hire

Quasar

Go implementation of the quasar protocol.

Simulation Statistics

Subscription false positive rate.

The more saturated the root subscription bloom filter becomes, the more false positives.

Subscription False Positive rate

Topic subscription distribution.

A long tail power law is assumed for the distribution of topic subscriptions, loosly based on twitter data.

Subscription Distribution

Testing Setup

The simulation uses a mock overlay network. This allows quick isolated testing of the quasar protocol.

It does not allow testing of: Peer discovery, churn behaviour, NAT traversal or behaviour of different overlay networks.

Default configuration:

  • Network size: 2048 Nodes
  • Subscriptions per node: 1024
  • Default event ttl: 64 hops
  • Filter freshness: 50000
  • Filter propagation delay: 20000
  • Filters depth: 3
  • Filters m: 4096
  • Filters k: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StandardConfig = Config{
	DefaultEventTTL:  64,
	FilterFreshness:  50000,
	PropagationDelay: 20000,
	HistoryLimit:     1048576,
	HistoryAccuracy:  1.0 / 1048576.0,
	FiltersDepth:     8,
	FiltersM:         10240,
	FiltersK:         7,
}

StandardConfig uses well agreed upon values, only deviate for testing.

Functions

func Simulate

func Simulate(
	c *Config,
	size int,
	pubs int,
	subs int,
	logStdOut bool,
) map[string]float64

Simulate network behaviour for given configuration, size, events published, topics subscribed to by node. Returns map with resulting statistics.

Types

type Config

type Config struct {
	DefaultEventTTL  uint32  // decremented every hop
	FilterFreshness  uint64  // in ms (older filters ignored)
	PropagationDelay uint64  // in ms (when filters sent to peers)
	HistoryLimit     uint32  // nr of event entries probably remembered
	HistoryAccuracy  float64 // false positive chance between 0.0 and 1.0
	FiltersDepth     uint32  // attenuated bloom filter depth
	FiltersM         uint64  // bloom filter m bits (multiple of 64)
	FiltersK         uint64  // bloom filter k hashes
}

Config for a quasar node.

type Node

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

Node holds the quasar pubsup state

func New

func New() *Node

New create instance with the sane defaults.

func (*Node) Publish

func (n *Node) Publish(topic []byte, message []byte)

Publish a message on the network for given topic.

func (*Node) Start

func (n *Node) Start()

Start quasar system

func (*Node) Stop

func (n *Node) Stop()

Stop quasar system

func (*Node) Subscribe

func (n *Node) Subscribe(topic []byte, receiver io.Writer)

Subscribe provided message receiver to given topic.

func (*Node) SubscribeDigest

func (n *Node) SubscribeDigest(digest *sha256digest, receiver io.Writer)

Subscribe provided message receiver to given topic digest.

func (*Node) Subscribed

func (n *Node) Subscribed(topic []byte) bool

Subscribed returns true if node is subscribed to given topic.

func (*Node) SubscribedDigest

func (n *Node) SubscribedDigest(digest *sha256digest) bool

Subscribed returns true if node is subscribed to given topic digest.

func (*Node) Subscribers

func (n *Node) Subscribers(topic []byte) []io.Writer

Subscribers retruns message receivers for given topic.

func (*Node) Unsubscribe

func (n *Node) Unsubscribe(topic []byte, receiver io.Writer)

Unsubscribe message receiver channel from topic. If nil receiver channel is provided all message receiver channels for given topic will be removed.

Jump to

Keyboard shortcuts

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