lockstep

package
v0.0.0-...-897372c Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ActionSetSize = 1024
	ActionSetPool = sync.Pool{
		New: func() interface{} {
			return make([]ActionSet, ActionSetSize)
		},
	}
)

Functions

This section is empty.

Types

type Action

type Action struct {
	Value interface{}
}

type ActionSet

type ActionSet struct {
	ID     uint32
	Action *Action
}

type ActionSlice

type ActionSlice []ActionSet

func (ActionSlice) FindAsIsSorted

func (s ActionSlice) FindAsIsSorted(id uint32) (*Action, bool)

func (ActionSlice) Len

func (s ActionSlice) Len() int

func (ActionSlice) Less

func (s ActionSlice) Less(i, j int) bool

func (ActionSlice) Swap

func (s ActionSlice) Swap(i, j int)

type ConditionLockStep

type ConditionLockStep struct {
	*LockStep
}

func NewConditionLockStep

func NewConditionLockStep(
	clone func(from interface{}) interface{},
) *ConditionLockStep

type Element

type Element struct {
	Value interface{}
}

type LockStep

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

func NewLockStep

func NewLockStep(
	step func(current *Element, action *Action),
	clone func(from interface{}) interface{},
) *LockStep

func (*LockStep) Add

func (s *LockStep) Add(id uint32, state interface{})

func (*LockStep) AddActionSlice

func (s *LockStep) AddActionSlice(
	actions []ActionSet,
) int

func (*LockStep) AddActions

func (s *LockStep) AddActions(
	actions map[uint32]interface{},
) int

func (*LockStep) Complete

func (s *LockStep) Complete(index int)

func (*LockStep) Drop

func (s *LockStep) Drop(index int)

func (*LockStep) LoadBase

func (s *LockStep) LoadBase(id uint32) (interface{}, bool)

func (*LockStep) LoadExpected

func (s *LockStep) LoadExpected(id uint32) (interface{}, bool)

func (*LockStep) Range

func (s *LockStep) Range(c func(id uint32, base, expected *Element) bool)

func (*LockStep) Remove

func (s *LockStep) Remove(id uint32)

type LockStepAction

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

type LockStepOperator

type LockStepOperator interface {
	Add(id uint32, state interface{})
	Remove(id uint32)
	Range(c func(id uint32, base, expected *Element) bool)
	LoadBase(id uint32) (interface{}, bool)
	LoadExpected(id uint32) (interface{}, bool)
	AddActions(actions map[uint32]interface{}) int
	AddActionSlice(actions []ActionSet) int
	Complete(index int)
	Drop(index int)
}

Jump to

Keyboard shortcuts

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