netwrk

package
v0.0.0-...-2ee7648 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const HEADER_SIZE int = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientSocket

type ClientSocket interface {

	// Send put msg to outbound queue
	Send(msg interface{})

	// Recv receives a message
	Recv() interface{}

	Close()
}

func NewClientSocket

func NewClientSocket(nodeId ids.ID, addrs map[ids.ID]string, transport, codec string) ClientSocket

type Codec

type Codec interface {
	Scheme() string
	Encode(msg interface{}) []byte
	Decode(data []byte) interface{}
}

Codec interface provide methods for serialization and deserialization

func NewCodec

func NewCodec(scheme string) Codec

NewCodec creates new codec object based on scheme, i.e. json and gob

type Message

type Message struct {
	Header []byte
	Body   []byte
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(sz int) *Message

func (*Message) Dup

func (m *Message) Dup() *Message

func (*Message) Expired

func (m *Message) Expired() bool

func (*Message) Free

func (m *Message) Free()

type MsgHeader

type MsgHeader struct {
	HLCTime hlc.Timestamp
}

func NewMsgHeaderFromBytes

func NewMsgHeaderFromBytes(bts []byte) *MsgHeader

func (MsgHeader) String

func (hdr MsgHeader) String() string

func (*MsgHeader) ToBytes

func (hdr *MsgHeader) ToBytes() []byte

type Socket

type Socket interface {

	// Send put msg to outbound queue
	Send(to ids.ID, msg interface{})

	// Multicast send msg to all nodes in the same site
	Multicast(zone uint8, msg interface{})

	// Broadcast send to all peers within the Replication Region
	//zone is the current zone of the node
	RBroadcast(zone uint8, msg interface{})

	// Broadcast send to all peers
	Broadcast(msg interface{})

	// Recv receives a message
	Recv() interface{}

	Close()

	GetReplicationGroupZones(zone uint8) []uint8
}

func NewSocket

func NewSocket(id ids.ID, addrs map[ids.ID]string, transport, codec string) Socket

type Transport

type Transport interface {
	Scheme() string
	Send(*Message)
	Recv() *Message
	Dial() error
	Listen()
	Close()
}

Transport = transport + pipe + bench + server

func NewTransport

func NewTransport(addr string) Transport

NewTransport creates new transport object with url

Jump to

Keyboard shortcuts

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