linearizability

package
v0.0.0-...-3029327 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEvents

func CheckEvents(model Model, history []Event) bool

func CheckEventsTimeout

func CheckEventsTimeout(model Model, history []Event, timeout time.Duration) bool

timeout = 0 means no timeout if this operation times out, then a false positive is possible

func CheckOperations

func CheckOperations(model Model, history []Operation) bool

func CheckOperationsTimeout

func CheckOperationsTimeout(model Model, history []Operation, timeout time.Duration) bool

timeout = 0 means no timeout if this operation times out, then a false positive is possible

func NoPartition

func NoPartition(history []Operation) [][]Operation

func NoPartitionEvent

func NoPartitionEvent(history []Event) [][]Event

func ShallowEqual

func ShallowEqual(state1, state2 interface{}) bool

Types

type Event

type Event struct {
	Kind  EventKind
	Value interface{}
	Id    uint
}

type EventKind

type EventKind bool
const (
	CallEvent   EventKind = false
	ReturnEvent EventKind = true
)

type KvInput

type KvInput struct {
	Op    uint8 // 0 => get, 1 => put, 2 => append
	Key   string
	Value string
}

type KvOutput

type KvOutput struct {
	Value string
}

type Model

type Model struct {
	// Partition functions, such that a history is linearizable if an only
	// if each partition is linearizable. If you don't want to implement
	// this, you can always use the `NoPartition` functions implemented
	// below.
	Partition      func(history []Operation) [][]Operation
	PartitionEvent func(history []Event) [][]Event
	// Initial state of the system.
	Init func() interface{}
	// Step function for the system. Returns whether or not the system
	// could take this step with the given inputs and outputs and also
	// returns the new state. This should not mutate the existing state.
	Step func(state interface{}, input interface{}, output interface{}) (bool, interface{})
	// Equality on states. If you are using a simple data type for states,
	// you can use the `ShallowEqual` function implemented below.
	Equal func(state1, state2 interface{}) bool
}

func KvModel

func KvModel() Model

type Operation

type Operation struct {
	Input  interface{}
	Call   int64 // invocation time
	Output interface{}
	Return int64 // response time
}

Jump to

Keyboard shortcuts

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