state

package
v0.0.0-...-f965b87 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2014 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
}

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