config

package
v0.72.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package config contains the logic to manage the config of the packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Directories

type Directories struct {
	StablePath     string
	ExperimentPath string
}

Directories is the directories of the config.

func (*Directories) GetState

func (d *Directories) GetState() (State, error)

GetState returns the state of the directories.

func (*Directories) PromoteExperiment

func (d *Directories) PromoteExperiment(_ context.Context) error

PromoteExperiment promotes the experiment to the stable.

func (*Directories) RemoveExperiment

func (d *Directories) RemoveExperiment(_ context.Context) error

RemoveExperiment removes the experiment from the directories.

func (*Directories) WriteExperiment

func (d *Directories) WriteExperiment(ctx context.Context, operations Operations) error

WriteExperiment writes the experiment to the directories.

type FileOperation

type FileOperation struct {
	FileOperationType FileOperationType `json:"file_op"`
	FilePath          string            `json:"file_path"`
	Patch             json.RawMessage   `json:"patch,omitempty"`
}

FileOperation is the operation to perform on a config.

type FileOperationType

type FileOperationType string

FileOperationType is the type of operation to perform on the config.

const (
	// FileOperationPatch patches the config at the given path with the given JSON patch (RFC 6902).
	FileOperationPatch FileOperationType = "patch"
	// FileOperationMergePatch merges the config at the given path with the given JSON merge patch (RFC 7396).
	FileOperationMergePatch FileOperationType = "merge-patch"
	// FileOperationDelete deletes the config at the given path.
	FileOperationDelete FileOperationType = "delete"
)

type Operations

type Operations struct {
	DeploymentID   string          `json:"deployment_id"`
	FileOperations []FileOperation `json:"file_operations"`
}

Operations is the list of operations to perform on the configs.

func (*Operations) Apply

func (o *Operations) Apply(rootPath string) error

Apply applies the operations to the root.

type State

type State struct {
	StableDeploymentID     string
	ExperimentDeploymentID string
}

State is the state of the directories.

Jump to

Keyboard shortcuts

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