util

package
v0.0.0-...-543b7a6 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PREPARE     = 1 << iota
	COMMIT      = 1 << iota
	SEND        = 1 << iota
	RCV         = 1 << iota
	CLS         = 1 << iota
	SIG         = 1 << iota
	WAIT        = 1 << iota
	WRITE       = 1 << iota
	READ        = 1 << iota
	ATOMICREAD  = 1 << iota
	ATOMICWRITE = 1 << iota
	LOCK        = 1 << iota
	UNLOCK      = 1 << iota
	RLOCK       = 1 << iota
	RUNLOCK     = 1 << iota
	PREBRANCH   = 1 << iota
	POSTBRANCH  = 1 << iota
	NT          = 1 << iota
	NTWT        = 1 << iota
	RMVSEND     = 0xF ^ SEND
	RMVRCV      = 0xF ^ RCV
	RMVPREP     = 0xF ^ PREPARE
	RMVCOT      = 0xF ^ COMMIT
	NOPARTNER   = "-"
	POST        = COMMIT
)
View Source
const (
	EXCLUSIVE  = 1 << iota
	READSHARED = 1 << iota
	SHARED     = 1 << iota
)

Variables

This section is empty.

Functions

func Max

func Max(a, b int) int

func ValidateTrace

func ValidateTrace(items []Item)

Types

type Alternative

type Alternative struct {
	Op     string   `json:"op"`
	Used   []string `json:"used"`
	Unused []string `json:"unused"`
}

type Alternative2

type Alternative2 struct {
	Op     *Item
	Used   []*Item
	Unused []*Item
}

type AsyncChan

type AsyncChan struct {
	Buf        []BufField
	BufSize    uint32
	Next       uint32
	Count      uint32
	Rnext      uint32
	IsLock     bool
	Rcounter   uint32
	SndCounter uint32
}

type BufField

type BufField struct {
	*Item
	VC VectorClock
}

type ChanState

type ChanState struct {
	Rvc      VectorClock
	Wvc      VectorClock
	WContext map[uint64]string
	RContext map[uint64]string
	//For RWLocks
	CountR int
	SndCnt uint32
}

func NewChanState

func NewChanState() *ChanState

type Epoch

type Epoch struct {
	X uint64
	T int
}

func NewEpoch

func NewEpoch(x uint64, t int) Epoch

func (Epoch) Less_Epoch

func (e Epoch) Less_Epoch(vc VectorClock) bool

func (*Epoch) Set

func (e *Epoch) Set(x uint64, t int)

type Item

type Item struct {
	Ops      []Operation
	Thread   uint32
	Partner  uint32
	LocalIdx int
}

func (Item) Clone

func (o Item) Clone() *Item

func (Item) ShortString

func (o Item) ShortString() string

func (*Item) String

func (o *Item) String() string

type OpKind

type OpKind int

func (OpKind) String

func (k OpKind) String() string

type Operation

type Operation struct {
	PC        uint64
	PPC       uint64
	Ch        uint32
	BufSize   uint32
	BufField  uint32
	SourceRef uint32
	Line      uint32
	Kind      OpKind
	Mutex     int
}

func (Operation) Clone

func (o Operation) Clone() Operation

func (Operation) String

func (o Operation) String() string

type Result

type Result struct {
	Alts []Alternative2
	POs  []Alternative2
}

type SyncPair

type SyncPair struct {
	T1           uint32
	T2           uint32
	AsyncSend    bool
	AsyncRcv     bool
	Closed       bool
	DoClose      bool
	GoStart      bool
	DataAccess   bool
	Write        bool
	Read         bool
	AtomicWrite  bool
	AtomicRead   bool
	Lock         bool
	Unlock       bool
	Sync         bool
	IsSelect     bool
	Idx          int
	T2Idx        int
	IsGoStart    bool
	IsFork       bool
	IsWait       bool
	IsPreBranch  bool
	IsPostBranch bool
	IsNT         bool
	IsNTWT       bool
	PostProcess  bool
	Counter      uint64
	Ev           *Item
}

func (SyncPair) String

func (s SyncPair) String() string

type Thread

type Thread struct {
	Events []*Item
	ID     uint32
}

func (Thread) Clone

func (t Thread) Clone() Thread

func (Thread) Peek

func (t Thread) Peek() *Item

func (*Thread) Pop

func (t *Thread) Pop()

func (Thread) ShortString

func (t Thread) ShortString() string

func (Thread) String

func (t Thread) String() string

type VState

type VState int

func (VState) String

func (s VState) String() string

type VarState1

type VarState1 struct {
	Rvc     VectorClock
	Wvc     VectorClock
	PrevREv *Item
	PrevWEv *Item
}

type VarState2

type VarState2 struct {
	Rvc     VectorClock
	Wepoch  Epoch
	Repoch  Epoch
	PrevREv *Item
	PrevWEv *Item
}

type VarState3

type VarState3 struct {
	Rvc        VectorClock
	Wvc        VectorClock
	Wepoch     Epoch
	Repoch     Epoch
	State      VState
	LastAccess uint64
	LastOp     *Operation
	LastEv     *Item
	LastSP     *SyncPair
	MutexSet   map[uint64]struct{}
	PrevREv    *Item
	PrevWEv    *Item
	TSet       VectorClock
}

VarState3 for Epoch + Eraser solution

type VectorClock

type VectorClock map[uint64]int

func NewVC

func NewVC() VectorClock

func (VectorClock) Add

func (vc VectorClock) Add(k uint64, val int)

func (VectorClock) AddEpoch

func (vc VectorClock) AddEpoch(ep Epoch)

func (VectorClock) Clone

func (vc VectorClock) Clone() VectorClock

func (VectorClock) ConcurrentTo

func (vc VectorClock) ConcurrentTo(pvc VectorClock) bool

func (VectorClock) Equals

func (vc VectorClock) Equals(pvc VectorClock) bool

func (VectorClock) FindConflict

func (vc VectorClock) FindConflict(pvc VectorClock) uint64

func (VectorClock) HasConflict

func (vc VectorClock) HasConflict(pvc VectorClock) bool

func (VectorClock) Less

func (vc VectorClock) Less(pvc VectorClock) bool

func (VectorClock) Less_Epoch

func (vc VectorClock) Less_Epoch(pepoch Epoch) bool

func (VectorClock) Remove

func (vc VectorClock) Remove(pvc VectorClock) VectorClock

func (VectorClock) Set

func (vc VectorClock) Set(k uint64, val int)

func (VectorClock) String

func (vc VectorClock) String() string

func (VectorClock) Sync

func (vc VectorClock) Sync(pvc VectorClock)

Jump to

Keyboard shortcuts

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