core

package
v0.0.0-...-b9f6a0d Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package core maintains common configuration values used in the network it also encodes and decodes internal and external messages and queries

Index

Constants

View Source
const (
	// DefaultEventChannelSize ...
	DefaultEventChannelSize = 64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	sync.Once
	Initialized     bool
	LogOutput       io.Writer
	Logger          *log.Logger
	ShutdownCh      chan struct{}
	DevelopmentMode bool
	NodeName        string
	ExternalEventCh chan Event
	InrernalEventCh chan Event
	// contains filtered or unexported fields
}

Config ...

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig ...

func (*Config) AgentHelloEvent

func (c *Config) AgentHelloEvent(address string) (*sentry.SignedMessage, error)

AgentHelloEvent ...

func (*Config) Init

func (c *Config) Init()

Init ...

func (*Config) Sentry

func (c *Config) Sentry() *sentry.Sentry

Sentry ...

type Event

type Event interface {
	EventType() EventType
	String() string
}

Event ...

type EventType

type EventType int

EventType ...

const (
	// EventPeerAdded ...
	EventHello EventType = iota
	// Update ...
	EventUpdate
	// Leave ...
	EventLeave
)

func (EventType) String

func (e EventType) String() string

String ...

type GossipEvent

type GossipEvent struct {
	LTime   lamportclock.LamportTime
	Name    string
	Payload []byte
}

GossipEvent ...

type HelloEvent

type HelloEvent GossipEvent

HelloEvent ...

func (HelloEvent) EventType

func (u HelloEvent) EventType() EventType

EventType ...

func (HelloEvent) String

func (u HelloEvent) String() string

String ...

type HelloPayload

type HelloPayload struct {
	YourAddr string
}

HelloPayload ...

type LeaveEvent

type LeaveEvent GossipEvent

LeaveEvent ...

func (LeaveEvent) EventType

func (u LeaveEvent) EventType() EventType

EventType ...

func (LeaveEvent) String

func (u LeaveEvent) String() string

String ...

type State

type State uint32

State ...

const (
	// Initialized ...
	Initialized State = iota
	// Running ...
	Running
	// Shutdown ...
	Shutdown
)

func (State) String

func (s State) String() string

String ...

type UpdateEvent

type UpdateEvent GossipEvent

UpdateEvent ...

func (UpdateEvent) EventType

func (u UpdateEvent) EventType() EventType

EventType ...

func (UpdateEvent) String

func (u UpdateEvent) String() string

String ...

Jump to

Keyboard shortcuts

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