ldmigration

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 1 Imported by: 6

Documentation

Overview

Package ldmigration contains general types used by LaunchDarkly SDK components to support technology migrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsistencyCheck

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

ConsistencyCheck records the results of a consistency check and the ratio at which the check was sampled.

For example, a sampling ratio of 10 indicts this consistency check was sampled approximately once every ten operations.

func NewConsistencyCheck

func NewConsistencyCheck(wasConsistent bool, samplingRatio int) *ConsistencyCheck

NewConsistencyCheck creates a new consistency check reflecting the provided values.

func (ConsistencyCheck) Consistent

func (c ConsistencyCheck) Consistent() bool

Consistent returns whether or not the check returned a consistent result.

func (ConsistencyCheck) SamplingRatio

func (c ConsistencyCheck) SamplingRatio() int

SamplingRatio returns the 1 in x sampling ratio used to determine if the consistency check should be run.

type ExecutionOrder

type ExecutionOrder string

ExecutionOrder represents the various execution modes this SDK can operate under while performing migration-assisted reads.

const (
	// Serial execution ensures the authoritative read will always complete execution before executing the
	// non-authoritative read.
	Serial ExecutionOrder = "serial"
	// Random execution randomly decides if the authoritative read should execute first or second.
	Random ExecutionOrder = "random"
	// Concurrent executes both reads in separate go routines, and waits until both calls have finished before
	// proceeding.
	Concurrent ExecutionOrder = "concurrent"
)

type Operation

type Operation string

Operation represents a type of migration operation; namely, read or write.

const (
	// Read denotes a read-related migration operation.
	Read Operation = "read"
	// Write denotes a write-related migration operation.
	Write Operation = "write"
)

type Origin

type Origin string

Origin represents the source of origin for a migration-related operation.

const (
	// Old represents the technology source we are migrating away from.
	Old Origin = "old"
	// New represents the technology source we are migrating towards.
	New Origin = "new"
)

type Stage

type Stage string

Stage denotes one of six possible stages a technology migration could be a part of, progressing through the following order.

Off -> DualWrite -> Shadow -> Live -> RampDown -> Complete

const (
	// Off - migration hasn't started, "old" is authoritative for reads and writes
	Off Stage = "off"

	// DualWrite - write to both "old" and "new", "old" is authoritative for reads
	DualWrite Stage = "dualwrite"

	// Shadow - both "new" and "old" versions run with a preference for "old"
	Shadow Stage = "shadow"

	// Live - both "new" and "old" versions run with a preference for "new"
	Live Stage = "live"

	// RampDown - only read from "new", write to "old" and "new"
	RampDown Stage = "rampdown"

	// Complete - migration is done
	Complete Stage = "complete"
)

func ParseStage

func ParseStage(val string) (Stage, error)

ParseStage parses a MigrationStage from a string, or returns an error if the stage is unrecognized.

Jump to

Keyboard shortcuts

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