Documentation ¶
Index ¶
- Variables
- func ErrInvalidNamespace(ns string) error
- func GetType[T entry](entries []T) (urn.UpdateType, error)
- func ManifestMetadataFromContext(ctx context.Context) (*controlv1.UpdateManifest, bool)
- func RegisterAgentSyncHandlerBuilder(strategy string, builder SyncHandlerBuilder)
- func RegisterPluginSyncHandlerBuilder(strategy string, builder SyncHandlerBuilder)
- type ManifestEntryList
- type SyncConfig
- type SyncHandler
- type SyncHandlerBuilder
- type UpdateServer
- func (s *UpdateServer) Collectors() []prometheus.Collector
- func (s *UpdateServer) RegisterUpdateHandler(strategy string, handler UpdateTypeHandler)
- func (s *UpdateServer) StreamServerInterceptor() grpc.StreamServerInterceptor
- func (s *UpdateServer) SyncManifest(ctx context.Context, manifest *controlv1.UpdateManifest) (*controlv1.SyncResults, error)
- type UpdateStreamInterceptor
- type UpdateTypeHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidURN = errors.New("invalid URN") ErrInvalidType = errors.New("type must be one of plugin or agent") ErrMultipleStrategies = errors.New("multiple strategies found in manifest") ErrMultipleTypes = errors.New("multiple types found in manifest") ErrNoEntries = errors.New("no entries found in manifest") ErrInvalidConfig = errors.New("invalid config") )
Functions ¶
func ErrInvalidNamespace ¶
func GetType ¶
func GetType[T entry](entries []T) (urn.UpdateType, error)
func ManifestMetadataFromContext ¶
func ManifestMetadataFromContext(ctx context.Context) (*controlv1.UpdateManifest, bool)
func RegisterAgentSyncHandlerBuilder ¶
func RegisterAgentSyncHandlerBuilder(strategy string, builder SyncHandlerBuilder)
func RegisterPluginSyncHandlerBuilder ¶
func RegisterPluginSyncHandlerBuilder(strategy string, builder SyncHandlerBuilder)
Types ¶
type ManifestEntryList ¶
type ManifestEntryList []*controlv1.UpdateManifestEntry
type SyncConfig ¶ added in v0.11.1
type SyncConfig struct { Client controlv1.UpdateSyncClient Syncer SyncHandler Logger *zap.SugaredLogger }
func (SyncConfig) DoSync ¶ added in v0.11.1
func (conf SyncConfig) DoSync(ctx context.Context) error
func (SyncConfig) Result ¶ added in v0.11.1
func (conf SyncConfig) Result(ctx context.Context) (*controlv1.UpdateManifest, error)
type SyncHandler ¶
type SyncHandlerBuilder ¶
type SyncHandlerBuilder func(...any) (SyncHandler, error)
func GetAgentSyncHandlerBuilder ¶
func GetAgentSyncHandlerBuilder[T ~string](strategy T) SyncHandlerBuilder
func GetPluginSyncHandlerBuilder ¶
func GetPluginSyncHandlerBuilder[T ~string](strategy T) SyncHandlerBuilder
type UpdateServer ¶
type UpdateServer struct { controlv1.UnsafeUpdateSyncServer // contains filtered or unexported fields }
func NewUpdateServer ¶
func NewUpdateServer(lg *zap.SugaredLogger) *UpdateServer
func (*UpdateServer) Collectors ¶
func (s *UpdateServer) Collectors() []prometheus.Collector
func (*UpdateServer) RegisterUpdateHandler ¶
func (s *UpdateServer) RegisterUpdateHandler(strategy string, handler UpdateTypeHandler)
func (*UpdateServer) StreamServerInterceptor ¶
func (s *UpdateServer) StreamServerInterceptor() grpc.StreamServerInterceptor
func (*UpdateServer) SyncManifest ¶
func (s *UpdateServer) SyncManifest(ctx context.Context, manifest *controlv1.UpdateManifest) (*controlv1.SyncResults, error)
SyncManifest implements UpdateSync. It expects a manifest with a single type and a single strategy. It will return an error if either of these conditions are not met. The package URN must be in the following format urn:opni:<type>:<strategy>:<name>
type UpdateStreamInterceptor ¶
type UpdateStreamInterceptor interface {
StreamServerInterceptor() grpc.StreamServerInterceptor
}
type UpdateTypeHandler ¶
type UpdateTypeHandler interface { CalculateUpdate(context.Context, *controlv1.UpdateManifest) (*controlv1.PatchList, error) CalculateExpectedManifest(context.Context, urn.UpdateType) (*controlv1.UpdateManifest, error) Collectors() []prometheus.Collector Strategy() string }
Click to show internal directories.
Click to hide internal directories.