splits

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromFile

func FromFile(migrationVersion *string, serializable *serializers.SplitYAML) (migrations.IMigration, error)

FromFile reifies a migration from the yaml serializable representation

func IsFeatureGateFromName added in v1.0.0

func IsFeatureGateFromName(name string) bool

IsFeatureGateFromName returns true if name ends with '_enabled'

func New

func New(name *string, weights *Weights) (migrations.IMigration, error)

New returns a migration object

Types

type ISplitMigration

type ISplitMigration interface {
	ResourceKey() SplitKey
}

ISplitMigration defines the interface that allows split-impacting migration types to determine whether they operate on the same split

type Split

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

Split represents a feature we're marking (un)completed

func MostRecentNamed

func MostRecentNamed(name, migrationVersion string, migrationRepo migrations.Repository) *Split

MostRecentNamed returns the most recent matching migration in a repo

func (*Split) ApplyToSchema

func (s *Split) ApplyToSchema(schema *serializers.Schema, migrationRepo migrations.Repository, _idempotently bool) error

ApplyToSchema applies a migrations changes to in-memory schema representation

func (*Split) File

func (s *Split) File() *serializers.MigrationFile

File returns a serializable MigrationFile for this migration

func (*Split) Filename

func (s *Split) Filename() *string

Filename generates a filename for this migration

func (*Split) MigrationVersion

func (s *Split) MigrationVersion() *string

MigrationVersion returns the migration version

func (*Split) ResourceKey

func (s *Split) ResourceKey() SplitKey

ResourceKey returns the natural key of the resource under migration

func (*Split) SameResourceAs

func (s *Split) SameResourceAs(other migrations.IMigration) bool

SameResourceAs returns whether the migrations refer to the same TestTrack resource

func (*Split) Serializable

func (s *Split) Serializable() interface{}

Serializable returns a JSON-serializable representation

func (*Split) SyncPath

func (s *Split) SyncPath() string

SyncPath returns the server path to post the migration to

func (*Split) Validate

func (s *Split) Validate() error

Validate validates that a feature completion may be persisted

func (*Split) Weights

func (s *Split) Weights() *Weights

Weights of the split

type SplitKey

type SplitKey string

SplitKey is the resource key for migrations impacting split state

type Weights

type Weights map[string]int

Weights represents the weightings of a split

func WeightsFromString

func WeightsFromString(weights string) (*Weights, error)

WeightsFromString parses a `variant: 0, another_variant: 100`-style string into a weights map

func WeightsFromYAML

func WeightsFromYAML(yamlWeights yaml.MapSlice) (*Weights, error)

WeightsFromYAML converts YAML-serializable weights to a weights map

func (*Weights) Merge

func (w *Weights) Merge(newWeights Weights)

Merge newWeights over weights

func (*Weights) ReweightToDecision

func (w *Weights) ReweightToDecision(variant string) error

ReweightToDecision sets weights to 100% one variant

func (*Weights) ToYAML

func (w *Weights) ToYAML() yaml.MapSlice

ToYAML converts weights to a YAML-serializable representation

Jump to

Keyboard shortcuts

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