router

package
v0.0.0-...-611bec0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 10 Imported by: 8

Documentation

Index

Constants

View Source
const DefaultPointer = "@production"
View Source
const HeaderRouter = "x-ocel-router"

Variables

This section is empty.

Functions

func FormatDeploymentPointer

func FormatDeploymentPointer(pointer, promotionID string) string

func IsDefaultPointer

func IsDefaultPointer(pointer string) bool

func ParseDeploymentPointer

func ParseDeploymentPointer(pointer string) (preview, promotionID string, ok bool)

func ResolvePointer

func ResolvePointer(pointer string) string

Types

type Claim

type Claim struct {
	Hostname             string
	App                  string
	Pointer              string
	Certificate          string
	CertificateRequested bool
	ClientCAs            []string
	OriginCertificate    edge.OriginCertificate
	Tunnel               edge.Kind
}

type EdgeBundle

type EdgeBundle struct {
	Key    string `json:"key"`
	Digest string `json:"digest"`
}

type Facts

type Facts struct {
	Propagation                 Propagation
	Supported                   []edge.Need
	CachesRecords               bool
	AddressesItself             bool
	SignsOriginForwards         bool
	ReachesFunctions            bool
	ReachesContainers           bool
	Dispatches                  bool
	AnswersHostnames            bool
	StopsServingRemovedPointers bool
	ServesPreviewDeployments    bool
}

type HistoryEntry

type HistoryEntry struct {
	Promotion
	Active     bool `json:"active"`
	Unpromoted bool `json:"unpromoted"`
}

type Hooks

type Hooks struct {
	Origin *OriginHooks
}

type Kind

type Kind string

type OriginHooks

type OriginHooks struct {
	PlanProjectRemoval      func(scope edge.ProjectScope) ([]edge.PlanGroup, error)
	ClaimPreviewEntry       func(ctx context.Context, claim Claim) (edge.Origin, error)
	DisclaimPreviewEntry    func(ctx context.Context, baseDomain string) error
	PlanPreviewEntryRemoval func(wildcard string) ([]edge.PlanGroup, error)
}

type PointerMove

type PointerMove struct {
	Pointer     string
	Promotion   Promotion
	Records     map[string]ReleaseRecord
	Hosts       []edge.PreviewHost
	Superseded  []edge.PreviewHost
	Kept        []Promotion
	StillActive StillActive
}

func (PointerMove) ListHostsToWithdraw

func (m PointerMove) ListHostsToWithdraw() []edge.PreviewHost

func (PointerMove) RefuseInactive

func (m PointerMove) RefuseInactive(ctx context.Context) error

type PointerRemoval

type PointerRemoval struct {
	Pointer string             `json:"pointer"`
	Hosts   []edge.PreviewHost `json:"hosts,omitempty"`
}

type Promotion

type Promotion struct {
	PromotionID string             `json:"promotionId"`
	Ts          int64              `json:"ts"`
	Releases    map[string]string  `json:"releases"`
	Tag         string             `json:"tag,omitempty"`
	Propagation *Propagation       `json:"propagation,omitempty"`
	Hosts       []edge.PreviewHost `json:"hosts,omitempty"`
}

type Propagation

type Propagation struct {
	Typical   time.Duration `json:"typical"`
	Published bool          `json:"published"`
}

type PruneResult

type PruneResult struct {
	KeptPromotionIDs           []string         `json:"keptPromotionIds"`
	RemovedPromotionIDs        []string         `json:"removedPromotionIds"`
	UnnamedRecordKeys          []string         `json:"unnamedRecordKeys"`
	SurvivingRecordKeys        []string         `json:"survivingRecordKeys"`
	SurvivingPointerRecordKeys []string         `json:"survivingPointerRecordKeys"`
	DeploymentRemovals         []PointerRemoval `json:"deploymentRemovals,omitempty"`
}

type ReleaseRecord

type ReleaseRecord struct {
	App                     string              `json:"app"`
	Framework               string              `json:"framework"`
	Release                 string              `json:"release"`
	BuildID                 string              `json:"buildId"`
	RootFunction            string              `json:"rootFunction"`
	RootFunctionPhysical    string              `json:"rootFunctionPhysical,omitempty"`
	Image                   string              `json:"image,omitempty"`
	Physical                string              `json:"physical,omitempty"`
	Revisions               map[string]string   `json:"revisions,omitempty"`
	Origin                  string              `json:"origin,omitempty"`
	HealthPath              string              `json:"healthPath,omitempty"`
	HealthPathDiscovered    bool                `json:"healthPathDiscovered,omitempty"`
	RouteTable              *RouteTableLocation `json:"routeTable,omitempty"`
	Static                  *edge.Static        `json:"static,omitempty"`
	FunctionURLs            map[string]string   `json:"functionUrls"`
	StorageCoordinate       string              `json:"storageCoordinate"`
	Prerenders              bool                `json:"prerenders,omitempty"`
	CreatedAt               int64               `json:"createdAt"`
	EdgeBundle              *EdgeBundle         `json:"edgeBundle,omitempty"`
	ReleaseFingerprint      string              `json:"releaseFingerprint,omitempty"`
	OriginSecretFingerprint string              `json:"originSecretFingerprint,omitempty"`
	Variables               []VariableRecord    `json:"variables,omitempty"`
	Needs                   []edge.Need         `json:"needs,omitempty"`
	SupportInEffect         []edge.Need         `json:"supportInEffect,omitempty"`
	Waived                  []edge.Need         `json:"waived,omitempty"`
	Secrets                 ReleaseSecrets      `json:"-"`
	Sealed                  []byte              `json:"sealed,omitempty" ts:"-"`
}

func (ReleaseRecord) ParseStorageCoordinate

func (r ReleaseRecord) ParseStorageCoordinate() (naming.Coordinate, error)

type ReleaseSecrets

type ReleaseSecrets struct {
	PurgeSecret string            `json:"purgeSecret,omitempty"`
	Env         map[string]string `json:"env,omitempty"`
	Envelope    string            `json:"envelope,omitempty"`
}

func (ReleaseSecrets) IsZero

func (s ReleaseSecrets) IsZero() bool

type RouteTable

type RouteTable struct {
	Format edge.RouteTableFormat `json:"format"`
	Table  json.RawMessage       `json:"table"`
}

type RouteTableLocation

type RouteTableLocation struct {
	Format edge.RouteTableFormat `json:"format"`
	Key    string                `json:"key"`
}

type Router

type Router interface {
	Kind() Kind

	Facts() Facts

	Hooks() Hooks

	Reconcile(ctx context.Context, spec StackSpec, prior StackState) (Stack, error)

	Open(state StackState) (Stack, error)
}

type Stack

type Stack interface {
	State() StackState

	Claim(ctx context.Context, claim Claim) (edge.Origin, error)

	Disclaim(ctx context.Context, hostname string) error

	MovePointer(ctx context.Context, move PointerMove, progress progress.Log) error

	RemovePointer(ctx context.Context, removal PointerRemoval, progress progress.Log) error

	Destroy(ctx context.Context) error
}

type StackSpec

type StackSpec struct {
	Tier environment.Tier
	Slug string
}

type StackState

type StackState struct {
	Slug string           `json:"slug,omitempty"`
	Tier environment.Tier `json:"tier,omitempty"`
	Edge edge.StackState  `json:"edge,omitzero"`
}

func NewStackState

func NewStackState(shared edge.StackState) StackState

func (StackState) WithSpec

func (s StackState) WithSpec(spec StackSpec) StackState

type StillActive

type StillActive func(ctx context.Context) error

type Unserved

type Unserved struct{ Err error }

func (Unserved) Error

func (u Unserved) Error() string

func (Unserved) Unwrap

func (u Unserved) Unwrap() error

type VariableRecord

type VariableRecord struct {
	Key     string `json:"key"`
	Folder  string `json:"folder,omitempty"`
	Version int64  `json:"version,omitempty"`
	Live    bool   `json:"live,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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