Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisSubscriber ¶
type RedisSubscriber struct { RDB *redis.Client Channel string Repo Repo Reg Registry Logger *slog.Logger BackoffMS int BackoffMaxMS int }
RedisSubscriber consumes widget events from Redis and updates the registry.
func (*RedisSubscriber) Start ¶
func (s *RedisSubscriber) Start(ctx context.Context) (stop func())
Start begins consuming events in a background goroutine.
type Registry ¶
type Registry interface { List(ctx context.Context, opt Options) ([]Widget, int, string, time.Time, error) Upsert(ctx context.Context, w Widget) error Remove(ctx context.Context, id string) error ApplyDiff(ctx context.Context, upserts []Widget, removes []string) (string, time.Time, error) Subscribe() (<-chan Event, func()) Has(id string) bool DefaultConfig(id string) []byte }
func NewInMemory ¶
func NewInMemory() Registry
type Repo ¶
type Repo interface { GetByID(ctx context.Context, id string) (widgetsrepo.Row, error) List(ctx context.Context, f widgetsrepo.Filter) ([]widgetsrepo.Row, int, error) }
Repo defines database operations required by the subscriber.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches a directory of widget JSON files and applies changes to the registry.
func NewWatcher ¶
type Widget ¶
type Widget struct { ID string `json:"id"` Name string `json:"name"` Version string `json:"version"` Type string `json:"type"` Scopes []string `json:"scopes"` Enabled bool `json:"enabled"` Description string `json:"description,omitempty"` Capabilities []string `json:"capabilities,omitempty"` Homepage string `json:"homepage,omitempty"` UpdatedAt time.Time `json:"updated_at"` Meta map[string]any `json:"meta,omitempty"` Tenants []string `json:"-"` }
Click to show internal directories.
Click to hide internal directories.