home

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRefreshPayload added in v1.0.2

func BuildRefreshPayload(updated *coreauth.Auth) ([]byte, error)

BuildRefreshPayload builds a build refresh payload.

func SanitizeAuthForDownstream

func SanitizeAuthForDownstream(auth *coreauth.Auth) *coreauth.Auth

SanitizeAuthForDownstream removes refresh-capable credentials from the auth payload before it is returned to downstream CPA nodes.

Types

type ClusterAdapter added in v1.0.2

type ClusterAdapter interface {
	Enabled() bool
	LoadAuthIndex(ctx context.Context) error
	ListMinimalAuths() []*coreauth.Auth
	GetFullAuth(ctx context.Context, uuid string) (*coreauth.Auth, error)
	LoadConfigYAML(ctx context.Context) ([]byte, error)
}

type DispatchResult

type DispatchResult struct {
	Model       string
	AccessToken string
	BaseURL     string
	APIKey      string

	AuthID   string
	Provider string

	Auth *coreauth.Auth
}

type ModelInfo

type ModelInfo = registry.ModelInfo

type Runtime

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

func NewRuntime

func NewRuntime(cfg *config.Config) (*Runtime, error)

NewRuntime creates a new runtime.

func (*Runtime) AccessManager

func (r *Runtime) AccessManager() *access.Manager

AccessManager handles an access manager.

func (*Runtime) AddToken

func (r *Runtime) AddToken(ctx context.Context, rawJSON string) (string, error)

AddToken stores a credential JSON blob into the auth directory and schedules it for use. It returns the created (or existing) auth file name under auth-dir.

func (*Runtime) ApplyConfigFromCluster added in v1.0.2

func (r *Runtime) ApplyConfigFromCluster(ctx context.Context, cfg *config.Config) error

ApplyConfigFromCluster updates apply config from cluster.

func (*Runtime) Authenticate

func (r *Runtime) Authenticate(ctx context.Context, headers http.Header) (*access.Result, *access.AuthError)

Authenticate validates request credentials and returns the access result.

func (*Runtime) Config

func (r *Runtime) Config() *config.Config

Config handles a config.

func (*Runtime) ConfigPath

func (r *Runtime) ConfigPath() string

ConfigPath handles a config path.

func (*Runtime) CoreManager

func (r *Runtime) CoreManager() *coreauth.Manager

CoreManager handles a core manager.

func (*Runtime) Dispatch

func (r *Runtime) Dispatch(ctx context.Context, reqModel string, headers http.Header) (*DispatchResult, error)

Dispatch processes dispatch.

func (*Runtime) PersistClusterUsagePayload added in v1.0.2

func (r *Runtime) PersistClusterUsagePayload(ctx context.Context, payload string) (bool, error)

PersistClusterUsagePayload stores persist cluster usage payload.

func (*Runtime) PublishConfigYAML

func (r *Runtime) PublishConfigYAML(payload []byte)

PublishConfigYAML handles a publish config yaml.

func (*Runtime) ReadConfigYAML

func (r *Runtime) ReadConfigYAML() ([]byte, error)

ReadConfigYAML loads read config yaml.

func (*Runtime) ReadConfigYAMLContext added in v1.0.2

func (r *Runtime) ReadConfigYAMLContext(ctx context.Context) ([]byte, error)

ReadConfigYAMLContext loads read config yaml context.

func (*Runtime) RecordUsagePayload

func (r *Runtime) RecordUsagePayload(ctx context.Context, payload string)

RecordUsagePayload applies downstream usage status to the scheduler auth state.

func (*Runtime) RefreshClusterAuthIndex added in v1.0.2

func (r *Runtime) RefreshClusterAuthIndex(ctx context.Context, uuid string) error

RefreshClusterAuthIndex refreshes refresh cluster auth index.

func (*Runtime) RefreshNow added in v1.0.2

func (r *Runtime) RefreshNow(ctx context.Context, authIndex string) ([]byte, error)

RefreshNow refreshes refresh now.

func (*Runtime) RefreshNowLocal added in v1.0.2

func (r *Runtime) RefreshNowLocal(ctx context.Context, authIndex string) ([]byte, error)

RefreshNowLocal refreshes refresh now local.

func (*Runtime) ReloadAuths added in v1.0.2

func (r *Runtime) ReloadAuths(ctx context.Context) error

ReloadAuths handles a reload auths.

func (*Runtime) SetClusterAdapter added in v1.0.2

func (r *Runtime) SetClusterAdapter(adapter ClusterAdapter)

SetClusterAdapter sets a cluster adapter.

func (*Runtime) SetClusterRefreshHandler added in v1.0.2

func (r *Runtime) SetClusterRefreshHandler(handler func(context.Context, string) ([]byte, error))

SetClusterRefreshHandler sets a cluster refresh handler.

func (*Runtime) Start

func (r *Runtime) Start(ctx context.Context, configPath string) error

Start starts the process.

func (*Runtime) StartAutoRefresh added in v1.0.2

func (r *Runtime) StartAutoRefresh(ctx context.Context)

StartAutoRefresh starts an auto refresh.

func (*Runtime) Stop

func (r *Runtime) Stop()

Stop stops the process.

func (*Runtime) StopAutoRefresh added in v1.0.2

func (r *Runtime) StopAutoRefresh()

StopAutoRefresh stops an auto refresh.

func (*Runtime) SubscribeConfigYAML

func (r *Runtime) SubscribeConfigYAML(subscriber func(payload []byte) error) (unsubscribe func())

SubscribeConfigYAML handles a subscribe config yaml.

func (*Runtime) UpdateAuthInMemory added in v1.0.2

func (r *Runtime) UpdateAuthInMemory(ctx context.Context, auth *coreauth.Auth) (*coreauth.Auth, error)

UpdateAuthInMemory updates an auth in memory.

Jump to

Keyboard shortcuts

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