model

package
v0.0.0-...-2627f95 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cursor

func Cursor(kv ptarmiganpb.KeyValue, sortTarget ptarmiganpb.Field) string

Cursor generates a page cursor based on the kv and sort target

func KVMatchesKeyRange

func KVMatchesKeyRange(keyRange ptarmiganpb.KeyRange, kv ptarmiganpb.KeyValue) bool

KVMatchesKeyRange returns true if the key range matches the kv

func KVMatchesPredicate

func KVMatchesPredicate(predicate ptarmiganpb.KVPredicate, kv ptarmiganpb.KeyValue) bool

KVMatchesPredicate returns true if the predicate matches the kv

func KVMatchesSelection

func KVMatchesSelection(selection []ptarmiganpb.KVPredicate, kv ptarmiganpb.KeyValue) bool

KVMatchesSelection returns true if the selection matches the kv

Types

type ReplicaStoreModel

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

ReplicaStoreModel is an in-memory model of a replica store It is used in property-based tests as a reference implementation of how a replica store should work.

func NewReplicaStoreModel

func NewReplicaStoreModel() *ReplicaStoreModel

NewReplicaStoreModel creates an empty replica store model

func (*ReplicaStoreModel) ApplyCompact

func (replicaStoreModel *ReplicaStoreModel) ApplyCompact(index uint64, revision int64)

ApplyCompact executes an ApplyCompact command on the model

func (*ReplicaStoreModel) ApplyCreateLease

func (replicaStoreModel *ReplicaStoreModel) ApplyCreateLease(index uint64, ttl int64) ptarmiganpb.Lease

ApplyCreateLease executes an ApplyCreateLease command on the model

func (*ReplicaStoreModel) ApplyRevokeLease

func (replicaStoreModel *ReplicaStoreModel) ApplyRevokeLease(index uint64, id int64)

ApplyRevokeLease executes an ApplyRevokeLease command on the model

func (*ReplicaStoreModel) ApplyTxn

func (replicaStoreModel *ReplicaStoreModel) ApplyTxn(index uint64, txn ptarmiganpb.KVTxnRequest) ptarmiganpb.KVTxnResponse

ApplyTxn executes an ApplyTxn command on the model

func (*ReplicaStoreModel) Changes

func (replicaStoreModel *ReplicaStoreModel) Changes(watch ptarmiganpb.KVWatchRequest, limit int) []ptarmiganpb.Event

Changes executes a Changes command on the model

func (*ReplicaStoreModel) DeepCopy

func (replicaStoreModel *ReplicaStoreModel) DeepCopy() *ReplicaStoreModel

DeepCopy produces a deep copy of this replica store model

func (*ReplicaStoreModel) GetLease

func (replicaStoreModel *ReplicaStoreModel) GetLease(id int64) ptarmiganpb.Lease

GetLease executes a GetLease command on the model

func (*ReplicaStoreModel) Index

func (replicaStoreModel *ReplicaStoreModel) Index() uint64

Index executes an Index command on the model

func (*ReplicaStoreModel) LastResponse

func (replicaStoreModel *ReplicaStoreModel) LastResponse() interface{}

LastResponse returns the return value of the last command processed by the model

func (*ReplicaStoreModel) Leases

func (replicaStoreModel *ReplicaStoreModel) Leases() []ptarmiganpb.Lease

Leases executes a Leases command on the model

func (*ReplicaStoreModel) NewestRevision

func (replicaStoreModel *ReplicaStoreModel) NewestRevision() int64

NewestRevision executes a NewestRevision command on the model

func (*ReplicaStoreModel) OldestRevision

func (replicaStoreModel *ReplicaStoreModel) OldestRevision() int64

OldestRevision executes a OldestRevision command on the model

func (*ReplicaStoreModel) Query

func (replicaStoreModel *ReplicaStoreModel) Query(request ptarmiganpb.KVQueryRequest) ptarmiganpb.KVQueryResponse

Query executes a Query command on the model

type RevisionModel

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

RevisionModel is an in-memory model of a replica store revision

func (RevisionModel) AllChanges

func (revisionModel RevisionModel) AllChanges() eventList

AllChanges returns a list of all the changes in the revision

func (RevisionModel) AllKvs

func (revisionModel RevisionModel) AllKvs() kvList

AllKvs returns a list of all the KVs in the revision

func (RevisionModel) DeepCopy

func (revisionModel RevisionModel) DeepCopy() RevisionModel

DeepCopy produces a deep copy of this revision model

func (RevisionModel) Next

func (revisionModel RevisionModel) Next() RevisionModel

Next generates a copy of this revision whose revision number is one more than this revision's revision number. The copy's changes will be empty.

Directories

Path Synopsis
Package gen contains generators for commands used in property-based tests
Package gen contains generators for commands used in property-based tests

Jump to

Keyboard shortcuts

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