warp

package
v0.0.0-...-99e9b4c Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2014 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	/* as sender / receiver of a message */
	SERVERID = -1 // server identifier

	/* in the field type of an event */
	ANTIMSG = -4 // the message is an anti-message

	/* in the field time of an event */
	ACK      = -5 // the message is an acknowledgement
	GVTEVAL  = -6
	ABORTMSG = -7
	RBMSG    = -8

	/* different types of ack messages */
	MINE  = -1 // the sender of the ACK assumes the responsibility for the message in the GVT evaluation
	YOURS = -2 // the sender of the ACK doesn't assume the responsibility for the message until the successive GVT evaluation

	/* significant constants */
	FEWFREEPLACES = 4000 // the free space in an array is too low
	LISTLEN       = 5000 // the max length of a queue
	HEAPSIZE      = 500  // heap size
	TOOLARGE      = 500

	/* possible message colors */
	WHITE     = 1
	BLACK     = 2
	NOTACOLOR = -1

	/* logs creation constants */
	LOGDIR = "logs/"
	PERM   = 0666
	GVTLOG = -3

	/* server managment constants */
	NOTIME = -2
	ERR    = -1
)
View Source
const (
	LPNOTSTART = iota
	LPRUNNING  = iota
	LPIDLE     = iota
	LPSTOPPED  = iota
	LPEVALGVT  = iota
)

possible process states

View Source
const EMPTY = -13
View Source
const EMPTYPLACE = 2
View Source
const EVARRSIZE = 2000
View Source
const MAXALLOCN = 1
View Source
const MAXBUFFER = 10000
View Source
const MAXTIME = 1<<31 - 1
View Source
const TOOFAR = 25 // limited optimism synchronization: sets how far from the GVT a LP can go

Variables

View Source
var (
	Lpnum        int
	N_gvt        int
	State        []int8
	N_rollback   []int
	EventManager func(ev *Event, l *LocalData)
	EndTime      Time

	StartTime time.Time
)
View Source
var (
	Chanptr *[]chan Message
)
View Source
var NPRINT int = 0

Functions

func AllocateChans

func AllocateChans(nChan int)

func CheckEvaluation

func CheckEvaluation() bool

if true the a GVT calculation is running

func Delete

func Delete(e Elem, L *list.List) bool

func DeleteAfter

func DeleteAfter(t Time, L *list.List)

delete all the elements with time >= t

func DeleteBefore

func DeleteBefore(t Time, L *list.List)

delete all the elements with time <= t

func GvtSetup

func GvtSetup(lpnum int)

func Insert

func Insert(e Elem, L *list.List) int

func IsPresent

func IsPresent(t Time, L *list.List) bool

Checks if an Element with time t is in the list

func NewList

func NewList() *list.List

list.List management functions

func NoticeEvent

func NoticeEvent(ev *Event, receiver Pid, data *LocalData)

* creates and sends a message to the receiver that contains the event to be * noticed. Saves the related anti-message in sender local area

func Print

func Print(L *list.List)

func Send

func Send(msg *Message)

Send a message to destination

func SetLocalMin

func SetLocalMin(time Time, pid Pid)

func SharedSetup

func SharedSetup(lpn int, simt Time, f func(ev *Event, l *LocalData))

func SimSetup

func SimSetup(lpn int, simt Time, f func(ev *Event, l *LocalData))

func Simulate

func Simulate(data *LocalData)

func StartEvaluation

func StartEvaluation(lpnum int)

func Sync

func Sync()

func Unlock

func Unlock()

Types

type Elem

type Elem interface {
	GetTime() Time
	IsEqual(e Elem) bool
}

interface useful as Elem of a List

func GetNearest

func GetNearest(t Time, L *list.List) Elem

type Event

type Event struct {
	Id   int32 // high-order 16 bits = LP info, low-order 16 bits = event info
	Time Time
	Type Info
}

func CreateEvent

func CreateEvent(id int32, t Time, info Info) *Event

func (Event) GetTime

func (ev Event) GetTime() Time

type Event implements Elem interface

func (Event) IsEqual

func (ev Event) IsEqual(e Elem) bool

type EventHeap

type EventHeap []Node

func InitializeHeap

func InitializeHeap() EventHeap

event heap initialization

func (*EventHeap) Delete

func (heap *EventHeap) Delete(evptr *Event) bool

deletes an event from the heap, that remains balanced

func (*EventHeap) DeleteExternId

func (heap *EventHeap) DeleteExternId(ev *Event) Event

* searches, deletes and returns an event using its identifier

func (*EventHeap) DeleteMatching

func (heap *EventHeap) DeleteMatching(f func(ev *Event, a ...interface{}) bool, t ...interface{})

func (*EventHeap) ExtractHead

func (heap *EventHeap) ExtractHead() *Event

extracts the first event in the heap, that remains balanced

func (*EventHeap) GetCopy

func (heap *EventHeap) GetCopy() EventHeap

func (*EventHeap) GetMinTime

func (heap *EventHeap) GetMinTime() Time

returns the minimum time in the heap

func (*EventHeap) GetString

func (heap *EventHeap) GetString() string

func (*EventHeap) Insert

func (heap *EventHeap) Insert(evptr *Event) bool

Insert an event in the heap, that remains balanced

func (*EventHeap) IsEmpty

func (heap *EventHeap) IsEmpty() bool

returns true if the heap has no events

func (*EventHeap) Print

func (heap *EventHeap) Print()

heap debug

func (*EventHeap) PrintNodes

func (heap *EventHeap) PrintNodes()

heap debug

type Info

type Info struct {
	From int
	To   int
	Flag int32
}

type LocalData

type LocalData struct {
	N_PROCESSED        int
	SimTime            Time
	Gvt                Time
	IndexLP            Pid
	FutureEvents       EventHeap
	ProcessedEvents    *list.List
	MsgSent            *list.List
	AntiMsg2Annihilate *list.List
	OutgoingMsg        *list.List
	Acked              *list.List
	Pending            bool
	GvtFlag            bool
}

func Initialize

func Initialize(i Pid) *LocalData

* every LP must perform an initialize() operation, that creates * the needed structures and variables

func SimInitialize

func SimInitialize(i Pid) *LocalData

* every LP must perform an initialize() operation, that creates all * the needed structures and variables

func (*LocalData) NewEvent

func (l *LocalData) NewEvent(ev *Event)

type Message

type Message struct {
	Sender   Pid
	Receiver Pid
	Ev       Event
}

func BlockingReceive

func BlockingReceive(recvid Pid) *Message

blocking receive

func CreateMessage

func CreateMessage(sendr Pid, recvr Pid, e Event) *Message

func Receive

func Receive(recvid Pid) *Message

type Node

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

type Pid

type Pid int16

type Time

type Time int32

func GetGvt

func GetGvt() Time

func GetMinTime

func GetMinTime(L *list.List) Time

type TimedMessage

type TimedMessage struct {
	M Message
	T Time
}

func (TimedMessage) GetTime

func (tm TimedMessage) GetTime() Time

type TimedMessage implements Elem interface

func (TimedMessage) IsEqual

func (tm TimedMessage) IsEqual(e Elem) bool

Jump to

Keyboard shortcuts

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