Documentation
¶
Index ¶
- Variables
- type Batch
- func (b *Batch) Consistency(c cql.Consistency) cql.Batch
- func (b *Batch) Exec() error
- func (b *Batch) ExecCAS(dest ...any) (applied bool, iter cql.Iter, err error)
- func (b *Batch) ExecCASContext(ctx context.Context, dest ...any) (applied bool, iter cql.Iter, err error)
- func (b *Batch) ExecContext(ctx context.Context) error
- func (b *Batch) IterContext(ctx context.Context) cql.Iter
- func (b *Batch) MapExecCAS(dest map[string]any) (applied bool, iter cql.Iter, err error)
- func (b *Batch) MapExecCASContext(ctx context.Context, dest map[string]any) (applied bool, iter cql.Iter, err error)
- func (b *Batch) Query(stmt string, args ...any) cql.Batch
- func (b *Batch) SerialConsistency(c cql.Consistency) cql.Batch
- func (b *Batch) Size() int
- func (b *Batch) Statements() []cql.BatchEntry
- func (b *Batch) WithTimestamp(ts int64) cql.Batch
- type ErrorIter
- func (i *ErrorIter) Close() error
- func (i *ErrorIter) Columns() []cql.ColumnInfo
- func (i *ErrorIter) MapScan(m map[string]any) bool
- func (i *ErrorIter) NumRows() int
- func (i *ErrorIter) PageState() []byte
- func (i *ErrorIter) Scan(dest ...any) bool
- func (i *ErrorIter) Scanner() cql.Scanner
- func (i *ErrorIter) SliceMap() ([]map[string]any, error)
- func (i *ErrorIter) Warnings() []string
- type ErrorScanner
- type Query
- func (q *Query) Consistency(c cql.Consistency) cql.Query
- func (q *Query) Exec() error
- func (q *Query) ExecContext(ctx context.Context) error
- func (q *Query) Iter() cql.Iter
- func (q *Query) IterContext(ctx context.Context) cql.Iter
- func (q *Query) MapScan(m map[string]any) error
- func (q *Query) MapScanCAS(dest map[string]any) (applied bool, err error)
- func (q *Query) MapScanCASContext(ctx context.Context, dest map[string]any) (applied bool, err error)
- func (q *Query) MapScanContext(ctx context.Context, m map[string]any) error
- func (q *Query) PageSize(n int) cql.Query
- func (q *Query) PageState(state []byte) cql.Query
- func (q *Query) Release()
- func (q *Query) Scan(dest ...any) error
- func (q *Query) ScanCAS(dest ...any) (applied bool, err error)
- func (q *Query) ScanCASContext(ctx context.Context, dest ...any) (applied bool, err error)
- func (q *Query) ScanContext(ctx context.Context, dest ...any) error
- func (q *Query) SerialConsistency(c cql.Consistency) cql.Query
- func (q *Query) Statement() string
- func (q *Query) Values() []any
- func (q *Query) WithTimestamp(ts int64) cql.Query
- type Session
- func (s *Session) Batch(kind cql.BatchType) cql.Batch
- func (s *Session) Close()
- func (s *Session) Counters() (exec, scan, drop int64)
- func (s *Session) Query(stmt string, values ...any) cql.Query
- func (s *Session) ResetCounters()
- func (s *Session) SetConfig(cfg SessionConfig)
- func (s *Session) SetErrorRate(rate float64)
- func (s *Session) SetLatency(d time.Duration)
- type SessionConfig
Constants ¶
This section is empty.
Variables ¶
var ErrChaosSimulated = errors.New("chaos: simulated failure")
ErrChaosSimulated is returned by SetErrorRate to simulate real cluster failures. Unlike types.ErrWriteDropped (which Helix treats as an operational state), this error is treated as a genuine write failure by AdaptiveDualWrite and the CQL client's DualClusterError path.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch wraps a cql.Batch to inject chaos.
func (*Batch) Consistency ¶
func (b *Batch) Consistency(c cql.Consistency) cql.Batch
func (*Batch) ExecCASContext ¶
func (*Batch) MapExecCAS ¶
func (*Batch) MapExecCASContext ¶
func (*Batch) SerialConsistency ¶
func (b *Batch) SerialConsistency(c cql.Consistency) cql.Batch
func (*Batch) Statements ¶
func (b *Batch) Statements() []cql.BatchEntry
type ErrorIter ¶
type ErrorIter struct {
// contains filtered or unexported fields
}
ErrorIter is a cql.Iter implementation that always returns an error.
func (*ErrorIter) Columns ¶
func (i *ErrorIter) Columns() []cql.ColumnInfo
type ErrorScanner ¶
type ErrorScanner struct {
// contains filtered or unexported fields
}
ErrorScanner is a cql.Scanner implementation that always returns an error.
func (*ErrorScanner) Err ¶
func (s *ErrorScanner) Err() error
func (*ErrorScanner) Next ¶
func (s *ErrorScanner) Next() bool
func (*ErrorScanner) Scan ¶
func (s *ErrorScanner) Scan(dest ...any) error
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query wraps a cql.Query to inject chaos.
func (*Query) Consistency ¶
func (q *Query) Consistency(c cql.Consistency) cql.Query
func (*Query) MapScanCAS ¶
func (*Query) MapScanCASContext ¶
func (*Query) MapScanContext ¶
func (*Query) ScanCASContext ¶
func (*Query) SerialConsistency ¶
func (q *Query) SerialConsistency(c cql.Consistency) cql.Query
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session wraps a cql.Session to inject chaos.
func NewSession ¶
NewSession creates a new chaos session wrapping the provided real session.
func (*Session) Close ¶
func (s *Session) Close()
Close is a no-op for the chaos session. The underlying session lifecycle is managed externally (e.g., by testutil.CQLCluster). This allows the chaos session to be reused across multiple helix client instances in simulation tests without prematurely closing the database connection.
func (*Session) Counters ¶ added in v1.1.0
Counters returns the cumulative operation counts since creation or last ResetCounters call. exec is the number of successful Exec/ExecCAS calls, scan is the number of successful Scan/Iter/MapScan calls, and drop is the number of operations rejected by chaos injection.
func (*Session) ResetCounters ¶ added in v1.1.0
func (s *Session) ResetCounters()
ResetCounters zeroes all operation counters.
func (*Session) SetConfig ¶
func (s *Session) SetConfig(cfg SessionConfig)
SetConfig updates the chaos configuration for the session.
func (*Session) SetErrorRate ¶
SetErrorRate sets a probability of error for operations. The injected error is ErrChaosSimulated (a real error), not types.ErrWriteDropped. This ensures AdaptiveDualWrite treats chaos failures as genuine write errors and accumulates strikes for degradation detection.
func (*Session) SetLatency ¶
SetLatency sets a fixed latency for all operations.