fileinformer

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package fileinformer implements a kube-style Informer and InformerFactory that can be used to watch files instead of kube apis.

Index

Constants

This section is empty.

Variables

View Source
var FileGroupVersion = schema.GroupVersion{
	Group:   "//LocalFile",
	Version: "v1",
}

FileGroupVersion is a sythetic GroupVersion that the informers use.

Functions

This section is empty.

Types

type Factory

type Factory struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Factory implements dynamicinformer.DynamicSharedInformerFactory, but for starting and managing FileInformers.

func NewFileInformerFactory

func NewFileInformerFactory(log logr.Logger, opts ...FactoryOptFunc) (*Factory, error)

NewFileInformerFactory creates a new Factory.

func (*Factory) ForResource

ForResource will create an informer for a specific file.

func (*Factory) Shutdown added in v0.8.0

func (f *Factory) Shutdown()

Shutdown stops watching the files defined by the informers.

func (*Factory) Start

func (f *Factory) Start(stopCh <-chan struct{})

Start starts watching the files defined by the informers.

func (*Factory) WaitForCacheSync

func (f *Factory) WaitForCacheSync(stopCh <-chan struct{}) map[schema.GroupVersionResource]bool

WaitForCacheSync waits until all files in the informers have been synced once.

type FactoryOptFunc added in v0.15.0

type FactoryOptFunc func(*FactoryOpts)

FactoryOptFunc mutates FactoryOpts.

func WithResyncPeriod added in v0.15.0

func WithResyncPeriod(resync time.Duration) FactoryOptFunc

WithResyncPeriod sets the resync period for informers created by the Factory. If not set, defaultResyncPeriod is used.

type FactoryOpts added in v0.15.0

type FactoryOpts struct {
	// ResyncPeriod is the period at which handlers added to file informers
	// created by this factory will receive a synthetic resync event.
	ResyncPeriod time.Duration
}

FactoryOpts configures a Factory.

type FileInformer

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

FileInformer is an informer that watches files instead of the kube api.

func NewFileInformer

func NewFileInformer(log logr.Logger, watcher *fsnotify.Watcher, gvr schema.GroupVersionResource) (*FileInformer, error)

NewFileInformer returns a new FileInformer using the default resync period. To customize the resync period, construct a Factory with WithResyncPeriod and use Factory.ForResource.

func (*FileInformer) Informer

func (f *FileInformer) Informer() cache.SharedIndexInformer

func (*FileInformer) Lister

func (f *FileInformer) Lister() cache.GenericLister

type FileSharedIndexInformer

type FileSharedIndexInformer struct {
	sync.Once
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewFileSharedIndexInformer

func NewFileSharedIndexInformer(log logr.Logger, fileName string, watcher *fsnotify.Watcher, defaultEventHandlerResyncPeriod time.Duration) *FileSharedIndexInformer

NewFileSharedIndexInformer creates a new informer watching the file Note that currently all event handlers share the default resync period.

func (*FileSharedIndexInformer) AddEventHandler

func (*FileSharedIndexInformer) AddEventHandlerWithOptions added in v0.12.0

AddEventHandlerWithOptions registers a handler with the informer. The supplied cache.HandlerOptions is accepted for interface compatibility but is not yet consumed: per-handler ResyncPeriod and other option fields are ignored, and all handlers share the resync period configured on the factory via WithResyncPeriod.

func (*FileSharedIndexInformer) AddEventHandlerWithResyncPeriod

func (*FileSharedIndexInformer) AddIndexers

func (f *FileSharedIndexInformer) AddIndexers(_ cache.Indexers) error

func (*FileSharedIndexInformer) Done added in v0.15.0

func (f *FileSharedIndexInformer) Done() <-chan struct{}

Done implements cache.DoneChecker; the channel is closed once the initial read of the file has been delivered to all handlers.

func (*FileSharedIndexInformer) GetController

func (f *FileSharedIndexInformer) GetController() cache.Controller

func (*FileSharedIndexInformer) GetIndexer

func (f *FileSharedIndexInformer) GetIndexer() cache.Indexer

func (*FileSharedIndexInformer) GetStore

func (f *FileSharedIndexInformer) GetStore() cache.Store

func (*FileSharedIndexInformer) HasSynced

func (f *FileSharedIndexInformer) HasSynced() bool

func (*FileSharedIndexInformer) HasSyncedChecker added in v0.15.0

func (f *FileSharedIndexInformer) HasSyncedChecker() cache.DoneChecker

HasSyncedChecker implements cache.SharedInformer

func (*FileSharedIndexInformer) IsStopped added in v0.6.0

func (f *FileSharedIndexInformer) IsStopped() bool

func (*FileSharedIndexInformer) LastSyncResourceVersion

func (f *FileSharedIndexInformer) LastSyncResourceVersion() string

func (*FileSharedIndexInformer) Name added in v0.15.0

func (f *FileSharedIndexInformer) Name() string

Name implements cache.DoneChecker

func (*FileSharedIndexInformer) RemoveEventHandler added in v0.6.0

RemoveEventHandler implements cache.SharedInformer

func (*FileSharedIndexInformer) Run

func (f *FileSharedIndexInformer) Run(stopCh <-chan struct{})

func (*FileSharedIndexInformer) RunWithContext added in v0.12.0

func (f *FileSharedIndexInformer) RunWithContext(ctx context.Context)

func (*FileSharedIndexInformer) SetTransform

func (f *FileSharedIndexInformer) SetTransform(_ cache.TransformFunc) error

func (*FileSharedIndexInformer) SetWatchErrorHandler

func (f *FileSharedIndexInformer) SetWatchErrorHandler(_ cache.WatchErrorHandler) error

func (*FileSharedIndexInformer) SetWatchErrorHandlerWithContext added in v0.12.0

func (f *FileSharedIndexInformer) SetWatchErrorHandlerWithContext(_ cache.WatchErrorHandlerWithContext) error

Jump to

Keyboard shortcuts

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