rwset

package
v1.0.0-preview Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KVRead

type KVRead struct {
	Key     string
	Version *version.Height
}

KVRead - a tuple of key and its version at the time of transaction simulation

func NewKVRead

func NewKVRead(key string, version *version.Height) *KVRead

NewKVRead constructs a new `KVRead`

func (*KVRead) Marshal

func (r *KVRead) Marshal(buf *proto.Buffer) error

Marshal serializes a `KVRead`

func (*KVRead) String

func (r *KVRead) String() string

String prints a `KVRead`

func (*KVRead) Unmarshal

func (r *KVRead) Unmarshal(buf *proto.Buffer) error

Unmarshal deserializes a `KVRead`

type KVWrite

type KVWrite struct {
	Key      string
	IsDelete bool
	Value    []byte
}

KVWrite - a tuple of key and it's value that a transaction wants to set during simulation. In addition, IsDelete is set to true iff the operation performed on the key is a delete operation

func NewKVWrite

func NewKVWrite(key string, value []byte) *KVWrite

NewKVWrite constructs a new `KVWrite`

func (*KVWrite) Marshal

func (w *KVWrite) Marshal(buf *proto.Buffer) error

Marshal serializes a `KVWrite`

func (*KVWrite) SetValue

func (w *KVWrite) SetValue(value []byte)

SetValue sets the new value for the key

func (*KVWrite) String

func (w *KVWrite) String() string

String prints a `KVWrite`

func (*KVWrite) Unmarshal

func (w *KVWrite) Unmarshal(buf *proto.Buffer) error

Unmarshal deserializes a `KVWrite`

type NsReadWriteSet

type NsReadWriteSet struct {
	NameSpace        string
	Reads            []*KVRead
	Writes           []*KVWrite
	RangeQueriesInfo []*RangeQueryInfo
}

NsReadWriteSet - a collection of all the reads and writes that belong to a common namespace

func (*NsReadWriteSet) Marshal

func (nsRW *NsReadWriteSet) Marshal(buf *proto.Buffer) error

Marshal serializes a `NsReadWriteSet`

func (*NsReadWriteSet) String

func (nsRW *NsReadWriteSet) String() string

String prints a `NsReadWriteSet`

func (*NsReadWriteSet) Unmarshal

func (nsRW *NsReadWriteSet) Unmarshal(buf *proto.Buffer) error

Unmarshal deserializes a `NsReadWriteSet`

type RWSet

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

RWSet maintains the read-write set

func NewRWSet

func NewRWSet() *RWSet

NewRWSet constructs a new instance of RWSet

func (*RWSet) AddToRangeQuerySet

func (rws *RWSet) AddToRangeQuerySet(ns string, rqi *RangeQueryInfo)

AddToRangeQuerySet adds a range query info for performing phantom read validation

func (*RWSet) AddToReadSet

func (rws *RWSet) AddToReadSet(ns string, key string, version *version.Height)

AddToReadSet adds a key and corresponding version to the read-set

func (*RWSet) AddToWriteSet

func (rws *RWSet) AddToWriteSet(ns string, key string, value []byte)

AddToWriteSet adds a key and value to the write-set

func (*RWSet) GetFromWriteSet

func (rws *RWSet) GetFromWriteSet(ns string, key string) ([]byte, bool)

GetFromWriteSet return the value of a key from the write-set

func (*RWSet) GetTxReadWriteSet

func (rws *RWSet) GetTxReadWriteSet() *TxReadWriteSet

GetTxReadWriteSet returns the read-write set in the form that can be serialized

type RangeQueryInfo

type RangeQueryInfo struct {
	StartKey     string
	EndKey       string
	ItrExhausted bool
	// contains filtered or unexported fields
}

RangeQueryInfo captures a range query executed by a transaction and the tuples <key,version> that are read by the transaction This it to be used to perform a phantom-read validation during commit

func (*RangeQueryInfo) AddResult

func (rqi *RangeQueryInfo) AddResult(kvRead *KVRead)

AddResult appends the result

func (*RangeQueryInfo) GetResultHash

func (rqi *RangeQueryInfo) GetResultHash() []byte

GetResultHash returns the resultHash

func (*RangeQueryInfo) GetResults

func (rqi *RangeQueryInfo) GetResults() []*KVRead

GetResults returns the results of the range query

func (*RangeQueryInfo) Marshal

func (rqi *RangeQueryInfo) Marshal(buf *proto.Buffer) error

Marshal serializes a `RangeQueryInfo`

func (*RangeQueryInfo) String

func (rqi *RangeQueryInfo) String() string

String prints a range query info

func (*RangeQueryInfo) Unmarshal

func (rqi *RangeQueryInfo) Unmarshal(buf *proto.Buffer) error

Unmarshal deserializes a `RangeQueryInfo`

type TxReadWriteSet

type TxReadWriteSet struct {
	NsRWs []*NsReadWriteSet
}

TxReadWriteSet - a collection of all the reads and writes collected as a result of a transaction simulation

func (*TxReadWriteSet) Marshal

func (txRW *TxReadWriteSet) Marshal() ([]byte, error)

Marshal serializes a `TxReadWriteSet`

func (*TxReadWriteSet) String

func (txRW *TxReadWriteSet) String() string

String prints a `TxReadWriteSet`

func (*TxReadWriteSet) Unmarshal

func (txRW *TxReadWriteSet) Unmarshal(b []byte) error

Unmarshal deserializes a `TxReadWriteSet`

Jump to

Keyboard shortcuts

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