state

package
v0.0.0-...-18e7bf9 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conflict

func Conflict(gamma *Command, delta *Command) bool

func ConflictBatch

func ConflictBatch(batch1 []Command, batch2 []Command) bool

func IsRead

func IsRead(command *Command) bool

Types

type Command

type Command struct {
	Op  Operation
	K   Key
	V   Value
	K1  Key
	V1  Value
	K2  Key
	V2  Value
	K3  Key
	V3  Value
	K4  Key
	V4  Value
	K5  Key
	V5  Value
	K6  Key
	V6  Value
	K7  Key
	V7  Value
	K8  Key
	V8  Value
	K9  Key
	V9  Value
	K10 Key
	V10 Value
	K11 Key
	V11 Value
	K12 Key
	V12 Value
	K13 Key
	V13 Value
	K14 Key
	V14 Value
	K15 Key
	V15 Value
}

func (*Command) Execute

func (c *Command) Execute(st *State) Value

func (*Command) Marshal

func (t *Command) Marshal(w io.Writer)

func (*Command) Unmarshal

func (t *Command) Unmarshal(r io.Reader) error

type Key

type Key int64

func (*Key) Marshal

func (t *Key) Marshal(w io.Writer)

func (*Key) Unmarshal

func (t *Key) Unmarshal(r io.Reader) error

type Operation

type Operation uint8
const (
	NONE Operation = iota
	PUT
	GET
	DELETE
	RLOCK
	WLOCK
)

type State

type State struct {
	Store map[Key]Value
	// contains filtered or unexported fields
}

func InitState

func InitState() *State

type Value

type Value int64
const NIL Value = 0

func (*Value) Marshal

func (t *Value) Marshal(w io.Writer)

func (*Value) Unmarshal

func (t *Value) Unmarshal(r io.Reader) error

Jump to

Keyboard shortcuts

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