Documentation ¶
Index ¶
- type ApiAccessBuilder
- func (re *ApiAccessBuilder) GetDescriptor() resource.Descriptor
- func (re *ApiAccessBuilder) MakeApiAccess(grpcConn grpc.ClientConnInterface) resource.Access
- func (re *ApiAccessBuilder) MakeWatcher(grpcConn grpc.ClientConnInterface, params *WatcherConfigParams, ...) Watcher
- func (re *ApiAccessBuilder) MakeWatcherFilterParams(filter resource.Filter, parentRef resource.Reference) WatcherFilterParams
- type ApiAccessConstructor
- type Registry
- func (r *Registry) FindApiAccessBuilder(descriptor resource.Descriptor) *ApiAccessBuilder
- func (r *Registry) RegisterApiAccessConstructor(descriptor resource.Descriptor, constructor ApiAccessConstructor)
- func (r *Registry) RegisterWatcherConstructor(descriptor resource.Descriptor, constructor WatcherConstructor)
- func (r *Registry) RegisterWatcherFilterConstructor(descriptor resource.Descriptor, constructor WatcherFilterConstructor)
- type Watcher
- type WatcherConfigBase
- type WatcherConfigParams
- type WatcherConstructor
- type WatcherEvent
- type WatcherEventBase
- type WatcherEventChange
- type WatcherFilterConstructor
- type WatcherFilterParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiAccessBuilder ¶ added in v0.4.16
type ApiAccessBuilder struct {
// contains filtered or unexported fields
}
ApiAccessBuilder is a helper object allowing constructing various API-based and resource-oriented access objects without explicit resource type.
func (*ApiAccessBuilder) GetDescriptor ¶ added in v0.4.16
func (re *ApiAccessBuilder) GetDescriptor() resource.Descriptor
func (*ApiAccessBuilder) MakeApiAccess ¶ added in v0.4.16
func (re *ApiAccessBuilder) MakeApiAccess(grpcConn grpc.ClientConnInterface) resource.Access
func (*ApiAccessBuilder) MakeWatcher ¶ added in v0.4.16
func (re *ApiAccessBuilder) MakeWatcher(grpcConn grpc.ClientConnInterface, params *WatcherConfigParams, filters ...WatcherFilterParams) Watcher
func (*ApiAccessBuilder) MakeWatcherFilterParams ¶ added in v0.4.16
func (re *ApiAccessBuilder) MakeWatcherFilterParams(filter resource.Filter, parentRef resource.Reference) WatcherFilterParams
type ApiAccessConstructor ¶ added in v0.4.16
type ApiAccessConstructor func(grpcConn grpc.ClientConnInterface) resource.Access
type Registry ¶ added in v0.4.16
type Registry struct {
// contains filtered or unexported fields
}
Registry contains all known builders of resource-oriented API access objects. It is responsibility of developer to import all resource access packages in order to ensure FindApiAccessBuilder does not return nil object.
func GetRegistry ¶ added in v0.4.16
func GetRegistry() *Registry
GetRegistry returns global registry instance
func (*Registry) FindApiAccessBuilder ¶ added in v0.4.16
func (r *Registry) FindApiAccessBuilder(descriptor resource.Descriptor) *ApiAccessBuilder
func (*Registry) RegisterApiAccessConstructor ¶ added in v0.4.16
func (r *Registry) RegisterApiAccessConstructor(descriptor resource.Descriptor, constructor ApiAccessConstructor)
func (*Registry) RegisterWatcherConstructor ¶ added in v0.4.16
func (r *Registry) RegisterWatcherConstructor(descriptor resource.Descriptor, constructor WatcherConstructor)
func (*Registry) RegisterWatcherFilterConstructor ¶ added in v0.4.16
func (r *Registry) RegisterWatcherFilterConstructor(descriptor resource.Descriptor, constructor WatcherFilterConstructor)
type Watcher ¶ added in v0.4.16
type Watcher interface { // IEvents returns an abstract channel of WatcherEvent instances. // It must not be called if its strong-typed version Events() was ever called. IEvents() <-chan WatcherEvent // InSync informs if watched collection is in sync. InSync() bool // GetIFilters returns all currently active filters. GetIFilters() []WatcherFilterParams // ResetIFilters resets active filters. It will trigger LostSync event. // It can be called anytime during watcher runtime. ResetIFilters(ctx context.Context, filters ...WatcherFilterParams) error // Run starts watcher. Run(ctx context.Context) error }
Watcher is a high-level component using watch collection API method. Unlike raw watch, Watcher is capable of managing multiple queries at once (achieving OR filter, not possible via raw API). It also handles in transparent way brief reconnections, hiding all recovery implementation details. It only communicates LostSync/Resync events to users in case of long-term connection failures. Although each Watcher implements this interface (allowing users to develop applications in abstraction of type if they need), each struct also has strong-typed methods specific to their underlying type
type WatcherConfigBase ¶ added in v0.4.16
type WatcherConfigBase struct { // Event buffer size WatcherEventBufferSize int // Time that watcher will wait before attempting to establish connection with server in the event of failure like // connectivity lost. This does not generate any event downstream. IF you need to receive notification about failure, // see RecoveryDeadline RetryTimeout time.Duration // In case of single failure of connectivity with server watcher will make attempts to recover // without communicating LostSync event - unless recovery exceeds specified RecoveryDeadline. // If watcher manages to recover eventually after deadline, next event will come with Resync flag set. // If you dont want to have any lost sync events and you want watcher handle it, set value to 0. RecoveryDeadline time.Duration }
WatcherConfigBase is a base struct for all actual implementations of WatcherConfig
func NewWatcherConfigBase ¶ added in v0.4.16
func NewWatcherConfigBase() *WatcherConfigBase
type WatcherConfigParams ¶ added in v0.4.16
type WatcherConfigParams struct { CfgBase *WatcherConfigBase FieldMask object.FieldMask OrderBy resource.OrderBy WatchType watch_type.WatchType View view.View ChunkSize int }
type WatcherConstructor ¶ added in v0.4.16
type WatcherConstructor func(grpcConn grpc.ClientConnInterface, params *WatcherConfigParams, filters ...WatcherFilterParams) Watcher
type WatcherEvent ¶
type WatcherEvent interface { // LostSync communicates issue like network connectivity problem LostSync() bool // Resync returns true if changes contains all data in current snapshot (Added changes) Resync() bool // GetRawAt returns change at given index, or nil if outside bounds GetRawAt(index int) WatcherEventChange // Length returns size of the change (always 0 if LostSync is true) Length() int // AppendRawChange adds additional change. Panic for incorrect type AppendRawChange(change WatcherEventChange) }
WatcherEvent informs user of Watcher about events & changes happening on observed collection.
type WatcherEventBase ¶ added in v0.4.16
type WatcherEventBase struct {
// contains filtered or unexported fields
}
WatcherEventBase is a base struct for all actual implementations of WatcherEvent.
func NewWatcherEventBase ¶ added in v0.4.16
func NewWatcherEventBase(resync bool) WatcherEventBase
func NewWatcherEventBaseLostSync ¶ added in v0.4.16
func NewWatcherEventBaseLostSync() WatcherEventBase
func (WatcherEventBase) LostSync ¶ added in v0.4.16
func (eb WatcherEventBase) LostSync() bool
func (WatcherEventBase) Resync ¶ added in v0.4.16
func (eb WatcherEventBase) Resync() bool
type WatcherEventChange ¶
type WatcherEventChange interface { // IsAdd tells if resource is newly added to the observed collection IsAdd() bool // IsModify tells if resource has been modified within observed collection IsModify() bool // IsDelete tells if resource has been removed from collection. IsDelete() bool // GetRawName returns name regardless of type GetRawName() resource.Name // GetRawAdded returns non-nil resource if IsAdd returns true GetRawAdded() resource.Resource // GetRawPrevious returns non-nil resource if IsModify returns true GetRawPrevious() resource.Resource // GetRawDeleted returns non-nil resource if IsDelete returns true GetRawDeleted() resource.Resource // GetRawCurrent returns non-nil resource if IsAdd or IsModify returns true GetRawCurrent() resource.Resource }
WatcherEventChange is a higher-level object built on top of API resource.ResourceChange object decorated with extra information like previous resource (in case of modify) or contents of deleted resource (in case of deletion).
type WatcherFilterConstructor ¶ added in v0.4.16
type WatcherFilterConstructor func(filter resource.Filter, parentRef resource.Reference) WatcherFilterParams