govec

package
v0.0.0-...-9ee40ec Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindExecutionNumber

func FindExecutionNumber(logname string) int

Types

type ClockPayload

type ClockPayload struct {
	Pid     string
	VcMap   map[string]uint64
	Payload interface{}
}

This is the data structure that is actually end on the wire

func (*ClockPayload) DecodeMsgpack

func (d *ClockPayload) DecodeMsgpack(dec *msgpack.Decoder) error

Custom decoder function, needed for msgpack interoperability

func (*ClockPayload) EncodeMsgpack

func (d *ClockPayload) EncodeMsgpack(enc *msgpack.Encoder) error

Custom encoder function, needed for msgpack interoperability

func (*ClockPayload) PrintDataBytes

func (d *ClockPayload) PrintDataBytes()

Prints the Data Stuct as Bytes

func (*ClockPayload) PrintDataString

func (d *ClockPayload) PrintDataString()

Prints the Data Struct as a String

type GoLog

type GoLog struct {

	//This bools Checks to send the VC Bundled with User Data on the Wire
	// if False, PrepareSend and UnpackReceive will simply forward their input
	//buffer to output and locally log event. If True, VC will be encoded into packet on wire
	VConWire bool
	// contains filtered or unexported fields
}

This is the Global Variable Struct that holds all the info needed to be maintained

func InitGoVector

func InitGoVector(processid string, logfilename string) *GoLog

This is the Start Up Function That should be called right at the start of

a program

func InitGoVectorMultipleExecutions

func InitGoVectorMultipleExecutions(processid string, logfilename string) *GoLog

This is the Start Up Function That should be called right at the start of a program, without deleting the old log. It just increments the execution

func New

func New() *GoLog

func (*GoLog) DefaultDecoder

func (gv *GoLog) DefaultDecoder(buf []byte, payload interface{}) error

func (*GoLog) DefaultEncoder

func (gv *GoLog) DefaultEncoder(payload interface{}) ([]byte, error)

func (*GoLog) DisableDebugMode

func (gv *GoLog) DisableDebugMode()

func (*GoLog) DisableLogging

func (gv *GoLog) DisableLogging()

func (*GoLog) EnableDebugMode

func (gv *GoLog) EnableDebugMode()

func (*GoLog) EnableLogging

func (gv *GoLog) EnableLogging()

func (*GoLog) GetCurrentVC

func (gv *GoLog) GetCurrentVC() []byte

func (*GoLog) GetCurrentVCAsClock

func (gv *GoLog) GetCurrentVCAsClock() vclock.VClock

func (*GoLog) LogLocalEvent

func (gv *GoLog) LogLocalEvent(Message string) bool

func (*GoLog) LogThis

func (gv *GoLog) LogThis(Message string, ProcessID string, VCString string) bool

func (*GoLog) PrepareSend

func (gv *GoLog) PrepareSend(mesg string, buf interface{}) []byte

This function is meant to be used immediately before sending. mesg will be logged along with the time of the send buf is encodeable data (structure or basic type) Returned is an encoded byte array with logging information

This function is meant to be called before sending a packet. Usually,
it should Update the Vector Clock for its own process, package with the clock
using msgpack and return the new byte array that should be sent onwards
using the Send Command

func (*GoLog) SetEncoderDecoder

func (gv *GoLog) SetEncoderDecoder(encoder func(interface{}) ([]byte, error), decoder func([]byte, interface{}) error)

func (*GoLog) UnpackReceive

func (gv *GoLog) UnpackReceive(mesg string, buf []byte, unpack interface{})

UnpackReceive is used to unmarshall network data into local structures mesg will be logged along with the vector time the receive happened buf is the network data, previously packaged by PrepareSend unpack is a pointer to a structure, the same as was packed by PrepareSend

This function is meant to be called immediately after receiving a packet. It unpacks the data
by the program, the vector clock. It updates vector clock and logs it. and returns the user data

func (*GoLog) WriteToFile

func (gv *GoLog) WriteToFile(Message string) bool

type GoPublisher

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

func NewGoPublisher

func NewGoPublisher(addr string, port string) *GoPublisher

Creates a GoPublisher and initiates a TCP-RPC connection that receives a nonce to identify the publisher when communicating with the broker.

func (*GoPublisher) PublishLocalMessage

func (gp *GoPublisher) PublishLocalMessage(msg string, processID string, vclock vclock.VClock) error

Publish a local message to the broker

func (*GoPublisher) PublishNetworkMessage

func (gp *GoPublisher) PublishNetworkMessage(msg string, processID string, vclock vclock.VClock) error

Publish a network message to the broker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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