multi

package
v0.2500.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package multi implements support for a runtime host aggregator that handles multiplexing multiple instances of other runtime hosts, to enable seamless transitions between versions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoActiveVersion is the error returned if there is no active version.
	ErrNoActiveVersion = errors.New("runtime/host/multi: no active version")

	// ErrNoSuchVersion is the error returned if the requested version is unknown.
	ErrNoSuchVersion = errors.New("runtime/host/multi: no such version")
)

Functions

This section is empty.

Types

type Aggregate

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

Aggregate is an aggregated runtime consisting of multiple instances of the same runtime (by ID), all with different versions.

func New

func New(id common.Namespace) *Aggregate

New returns a new aggregated runtime.

func (*Aggregate) Abort

func (agg *Aggregate) Abort(ctx context.Context, force bool) error

Abort implements host.Runtime.

func (*Aggregate) AddVersion added in v0.2500.0

func (agg *Aggregate) AddVersion(version version.Version, rt host.Runtime) error

AddVersion adds a new runtime version to the aggregate.

If the newly added version matches the active or the next version, this function will start the provided runtime.

The provided runtime must be newly provisioned, meaning Start() has not been called yet.

func (*Aggregate) Call

func (agg *Aggregate) Call(ctx context.Context, body *protocol.Body) (*protocol.Body, error)

Call implements host.Runtime.

func (*Aggregate) Component added in v0.2400.0

func (agg *Aggregate) Component(id component.ID) (host.Runtime, bool)

Component implements host.CompositeRuntime.

func (*Aggregate) GetActiveVersion added in v0.2400.0

func (agg *Aggregate) GetActiveVersion() (*version.Version, error)

GetActiveVersion implements host.Runtime.

func (*Aggregate) GetCapabilityTEE added in v0.2300.0

func (agg *Aggregate) GetCapabilityTEE() (*node.CapabilityTEE, error)

GetCapabilityTEE implements host.Runtime.

func (*Aggregate) GetInfo

GetInfo implements host.Runtime.

func (*Aggregate) HasVersion added in v0.2500.0

func (agg *Aggregate) HasVersion(version version.Version) bool

HasVersion checks if runtime host exists for the specified version.

func (*Aggregate) ID

func (agg *Aggregate) ID() common.Namespace

ID implements host.Runtime.

func (*Aggregate) RemoveVersion added in v0.2500.0

func (agg *Aggregate) RemoveVersion(version version.Version) error

RemoveVersion removes the specified version from the aggregate.

A version cannot be removed if it is currently running, meaning it is marked as the active version or the next version.

func (*Aggregate) SetVersion

func (agg *Aggregate) SetVersion(active *version.Version, next *version.Version)

SetVersion updates the active and next runtime versions.

If the aggregate is not running, this function simply updates the versions. Otherwise, it performs the following steps:

  • If the active version differs from the requested active version, it is unconditionally torn down using Stop().
  • If the requested active version has already been started as next version, the next version becomes the new active session. Otherwise, the new active version is started if it exists.
  • If the next version differs from the requested next version, it is unconditionally torn down using Stop().
  • If the next version is already the requested version, no action is taken. Otherwise, the new next version is started if it exists.

func (*Aggregate) Start

func (agg *Aggregate) Start()

Start implements host.Runtime.

func (*Aggregate) Stop

func (agg *Aggregate) Stop()

Stop implements host.Runtime.

func (*Aggregate) UpdateCapabilityTEE added in v0.2300.0

func (agg *Aggregate) UpdateCapabilityTEE()

UpdateCapabilityTEE implements host.Runtime.

func (*Aggregate) Version added in v0.2500.0

func (agg *Aggregate) Version(version version.Version) (host.Runtime, error)

Version retrieves the runtime host for the specified version.

func (*Aggregate) Versions added in v0.2500.0

func (agg *Aggregate) Versions() []version.Version

Versions returns a sorted list of all versions in the aggregate.

func (*Aggregate) WatchEvents

func (agg *Aggregate) WatchEvents() (<-chan *host.Event, pubsub.ClosableSubscription)

WatchEvents implements host.Runtime.

Jump to

Keyboard shortcuts

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