db

package
v0.0.0-...-2e52d37 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 6 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

Conflict checks if two commands are conflicting as reorder them will end in different states

func ConflictBatch

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

ConflictBatch checks if two batchs of commands are conflict

Types

type Command

type Command struct {
	Key       Key
	Value     Value
	ClientID  identity.NodeID
	CommandID int
}

Command of key-value database

func (Command) Empty

func (c Command) Empty() bool

func (Command) Equal

func (c Command) Equal(a Command) bool

func (Command) IsRead

func (c Command) IsRead() bool

func (Command) IsWrite

func (c Command) IsWrite() bool

func (Command) String

func (c Command) String() string

type Database

type Database interface {
	Execute(Command) Value
	History(Key) []Value
	Get(Key) Value
	Put(Key, Value)
}

Database defines a database interface TODO replace with more general StateMachine interface

func NewDatabase

func NewDatabase() Database

NewDatabase returns database that impelements Database interface

type Key

type Key int

Key type of the key-value database

type Value

type Value []byte

Jump to

Keyboard shortcuts

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