kvtest

package
v0.0.0-...-3ab43b7 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package kvtest supplies coordinators for tests outside package kv.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalCoordinator

type LocalCoordinator struct {
	NopCoordinator
	// contains filtered or unexported fields
}

func NewLocalCoordinator

func NewLocalCoordinator(st store.MVCCStore, options LocalOptions) *LocalCoordinator

func (*LocalCoordinator) Dispatch

func (*LocalCoordinator) LinearizableRead

func (c *LocalCoordinator) LinearizableRead(ctx context.Context) (uint64, error)

type LocalOptions

type LocalOptions struct {
	DelPrefix        PrefixMode
	CommitTimestamp  TimestampSource
	OCC              OCCMode
	ValidateReadKeys bool
	PatchCommitTS    bool
	// AdvanceCommitTS raises caller-supplied timestamps to at least store+1
	// and, for transactions, StartTS+1 (the filesystem fake's policy).
	AdvanceCommitTS bool
	// Clock, when set, is the HLC the coordinator issues and observes
	// timestamps on, so a wrapper can share it with its own Clock().
	Clock *kv.HLC
}

LocalOptions explicitly selects behaviours that historically differed among local fakes. Zero values reject prefix deletes, use the HLC, skip OCC and do not patch values. OCC-disabled writes are applied sequentially, like the old adapter fake; OCC-enabled groups go through the store's atomic validation.

type NopCoordinator

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

NopCoordinator implements only Coordinator; it always reports local leadership. The zero value is ready for use, including concurrent Clock calls.

func (*NopCoordinator) Clock

func (c *NopCoordinator) Clock() *kv.HLC

func (*NopCoordinator) Dispatch

func (*NopCoordinator) IsLeader

func (*NopCoordinator) IsLeader() bool

func (*NopCoordinator) IsLeaderForKey

func (*NopCoordinator) IsLeaderForKey([]byte) bool

func (*NopCoordinator) LinearizableRead

func (*NopCoordinator) LinearizableRead(context.Context) (uint64, error)

func (*NopCoordinator) RaftLeader

func (*NopCoordinator) RaftLeader() string

func (*NopCoordinator) RaftLeaderForKey

func (*NopCoordinator) RaftLeaderForKey([]byte) string

func (*NopCoordinator) VerifyLeader

func (*NopCoordinator) VerifyLeader(context.Context) error

func (*NopCoordinator) VerifyLeaderForKey

func (*NopCoordinator) VerifyLeaderForKey(context.Context, []byte) error

type OCCMode

type OCCMode uint8
const (
	OCCDisabled OCCMode = iota
	OCCTransactions
	OCCAllGroups
)

type PrefixMode

type PrefixMode uint8
const (
	PrefixReject PrefixMode = iota
	// PrefixApply permits standalone, non-transactional prefix deletes.
	PrefixApply
	PrefixIgnore
)

type TimestampSource

type TimestampSource uint8
const (
	TimestampHLC TimestampSource = iota
	TimestampStoreIncrement
	TimestampRequest
)

Jump to

Keyboard shortcuts

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