porcupine

package
v0.0.0-...-d482dbc Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown CheckResult = "Unknown" // timed out
	Ok                  = "Ok"
	Illegal             = "Illegal"
)

Variables

This section is empty.

Functions

func CheckEvents

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

func CheckOperations

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

func DefaultDescribeOperation

func DefaultDescribeOperation(input interface{}, output interface{}) string

func DefaultDescribeState

func DefaultDescribeState(state interface{}) string

func NoPartition

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

func NoPartitionEvent

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

func ShallowEqual

func ShallowEqual(state1, state2 interface{}) bool

func Visualize

func Visualize(model Model, info linearizationInfo, output io.Writer) error

func VisualizePath

func VisualizePath(model Model, info linearizationInfo, path string) error

Types

type CheckResult

type CheckResult string

func CheckEventsTimeout

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

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

func CheckEventsVerbose

func CheckEventsVerbose(model Model, history []Event, timeout time.Duration) (CheckResult, linearizationInfo)

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

func CheckOperationsTimeout

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

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

func CheckOperationsVerbose

func CheckOperationsVerbose(model Model, history []Operation, timeout time.Duration) (CheckResult, linearizationInfo)

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

type Event

type Event struct {
	ClientId int // optional, unless you want a visualization; zero-indexed
	Kind     EventKind
	Value    interface{}
	Id       int
}

type EventKind

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

type Model

type Model struct {
	// Partition functions, such that a history is linearizable if and 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
	// For visualization, describe an operation as a string.
	// For example, "Get('x') -> 'y'".
	DescribeOperation func(input interface{}, output interface{}) string
	// For visualization purposes, describe a state as a string.
	// For example, "{'x' -> 'y', 'z' -> 'w'}"
	DescribeState func(state interface{}) string
}

type Operation

type Operation struct {
	ClientId int // optional, unless you want a visualization; zero-indexed
	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