workload

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WorkloadStats added in v1.1.0

type WorkloadStats struct {
	WriteOK        atomic.Int64
	WriteAsync     atomic.Int64 // errors.Is(err, types.ErrWriteAsync)
	WriteDropped   atomic.Int64 // errors.Is(err, types.ErrWriteDropped)
	WriteFailed    atomic.Int64 // all other write errors
	DualClusterErr atomic.Int64 // errors.As(err, *types.DualClusterError)
	ReadOK         atomic.Int64
	ReadFailed     atomic.Int64
}

WorkloadStats tracks error classifications from the traffic generator.

func NewWorkloadStats added in v1.1.0

func NewWorkloadStats() *WorkloadStats

NewWorkloadStats creates a new WorkloadStats.

func (*WorkloadStats) Reset added in v1.1.0

func (s *WorkloadStats) Reset()

Reset zeroes all counters.

type WriteTracker

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

WriteTracker tracks successful writes for verification.

func NewWriteTracker

func NewWriteTracker() *WriteTracker

NewWriteTracker creates a new write tracker.

func (*WriteTracker) Count

func (t *WriteTracker) Count() int

Count returns the number of currently tracked writes. This value may decrease when VerifyAndPrune removes old entries. For write volume gates that need a monotonically increasing counter, use TotalWrites instead.

func (*WriteTracker) RandomKey added in v1.1.0

func (t *WriteTracker) RandomKey() gocql.UUID

RandomKey returns a random key from the tracked writes. Returns a zero UUID if no writes are tracked.

func (*WriteTracker) TotalWrites added in v1.3.0

func (t *WriteTracker) TotalWrites() int64

TotalWrites returns the total number of writes tracked since creation. Unlike Count, this value never decreases (pruning does not affect it), making it safe for write volume gate checks in scenarios.

func (*WriteTracker) TrackWrite

func (t *WriteTracker) TrackWrite(key gocql.UUID, timestampUnixNano int64)

TrackWrite records a successful write.

func (*WriteTracker) Verify

func (t *WriteTracker) Verify() error

Verify checks if the tracked writes exist in the database. In a real implementation, this would query the database. For now, we'll just return the count of tracked writes.

func (*WriteTracker) VerifyAndPrune

func (t *WriteTracker) VerifyAndPrune(sessionA, sessionB cql.Session, minAge time.Duration) (int, error)

VerifyAndPrune verifies writes older than minAge and removes them to save memory. This is essential for long-running soak tests.

The lock is held only while collecting and deleting stale keys from the map. DB verification queries run after the lock is released so that concurrent TrackWrite and Count calls are not blocked for the duration of the queries.

func (*WriteTracker) VerifyConsistency

func (t *WriteTracker) VerifyConsistency(sessionA, sessionB cql.Session) error

VerifyConsistency checks if all tracked writes exist in both clusters.

Jump to

Keyboard shortcuts

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