Documentation
¶
Overview ¶
Package hops contains the logic for running the hops server components and handling workloads
Index ¶
- Constants
- func ConsoleRouter(logger zerolog.Logger) chi.Router
- func EventRouter(eventsClient EventsClient, logger zerolog.Logger) chi.Router
- func Healthcheck(natsClient *nats.Client, endpoint string) func(http.Handler) http.Handler
- type AutomationsLoader
- func (al *AutomationsLoader) Get(hash string) (*dsl.Automations, error)
- func (al *AutomationsLoader) GetForSequence(ctx context.Context, sequenceID string, msgBundle nats.MessageBundle) (*dsl.Automations, error)
- func (al *AutomationsLoader) GetFromCache(hash string) *dsl.Automations
- func (al *AutomationsLoader) GetFromStore(hash string) (*dsl.Automations, error)
- func (al *AutomationsLoader) GetOrSetHashForSequence(ctx context.Context, sequenceID string, msgBundle nats.MessageBundle) (string, error)
- func (al *AutomationsLoader) Reload(ctx context.Context, tolerant bool) error
- func (al *AutomationsLoader) Save() error
- func (al *AutomationsLoader) SaveInCache(a *dsl.Automations, ttl time.Duration)
- func (al *AutomationsLoader) SaveInStore(a *dsl.Automations) error
- type DirNotifier
- type ErrFailedHopsParse
- type Event
- type EventItem
- type EventLog
- type EventsClient
- type HTTPAppConf
- type HTTPServer
- type HTTPServerConf
- type HopsServer
- type K8sAppConf
- type Runner
- type RunnerConf
- type Schedule
Constants ¶
const AutomationsHashKey = "hops"
Variables ¶
This section is empty.
Functions ¶
func ConsoleRouter ¶ added in v0.13.0
The console router serves the single page app for the console. It will serve the index.html file for any path that does not exist, allowing client-side to handle routing
func EventRouter ¶ added in v0.13.0
func EventRouter(eventsClient EventsClient, logger zerolog.Logger) chi.Router
Types ¶
type AutomationsLoader ¶ added in v0.17.0
type AutomationsLoader struct {
// contains filtered or unexported fields
}
func NewAutomationsLoader ¶ added in v0.17.0
func (*AutomationsLoader) Get ¶ added in v0.17.0
func (al *AutomationsLoader) Get(hash string) (*dsl.Automations, error)
Get returns the automations for the given hash key or the local automations if hash key is the empty string
func (*AutomationsLoader) GetForSequence ¶ added in v0.17.0
func (al *AutomationsLoader) GetForSequence(ctx context.Context, sequenceID string, msgBundle nats.MessageBundle) (*dsl.Automations, error)
GetForSequence returns the Automations assigned to an event sequence. If no Automations are assigned to a sequence, it first assigns and then returns the local Automations
This ensures that sequences are handled by a consistent configuration until completion, even if multiple hops instances handle the work.
func (*AutomationsLoader) GetFromCache ¶ added in v0.17.0
func (al *AutomationsLoader) GetFromCache(hash string) *dsl.Automations
GetFromCache returns Automations by hash key from the local cache
func (*AutomationsLoader) GetFromStore ¶ added in v0.17.0
func (al *AutomationsLoader) GetFromStore(hash string) (*dsl.Automations, error)
GetFromStore returns the Automations by hash key from object storage
func (*AutomationsLoader) GetOrSetHashForSequence ¶ added in v0.17.0
func (al *AutomationsLoader) GetOrSetHashForSequence(ctx context.Context, sequenceID string, msgBundle nats.MessageBundle) (string, error)
GetOrSetHashForSequence returns the Automations hash assigned to an event sequence. If no hash are assigned to a sequence, it first assigns and then returns the local Automations
This ensures that sequences are handled by a consistent configuration until completion, even if multiple hops instances handle the work.
func (*AutomationsLoader) Reload ¶ added in v0.17.0
func (al *AutomationsLoader) Reload(ctx context.Context, tolerant bool) error
func (*AutomationsLoader) Save ¶ added in v0.17.0
func (al *AutomationsLoader) Save() error
func (*AutomationsLoader) SaveInCache ¶ added in v0.17.0
func (al *AutomationsLoader) SaveInCache(a *dsl.Automations, ttl time.Duration)
func (*AutomationsLoader) SaveInStore ¶ added in v0.17.0
func (al *AutomationsLoader) SaveInStore(a *dsl.Automations) error
type DirNotifier ¶ added in v0.13.0
type DirNotifier struct {
// contains filtered or unexported fields
}
DirNotifier watches a path and its subdirectories for changes notifying when one occurs
func NewDirNotifier ¶ added in v0.13.0
func NewDirNotifier(path string) (*DirNotifier, error)
func (*DirNotifier) Close ¶ added in v0.13.0
func (d *DirNotifier) Close() error
type ErrFailedHopsParse ¶ added in v0.14.1
type ErrFailedHopsParse struct {
// contains filtered or unexported fields
}
func (ErrFailedHopsParse) Error ¶ added in v0.14.1
func (e ErrFailedHopsParse) Error() string
type EventItem ¶ added in v0.13.0
type EventItem struct { Event Event `json:"event"` SequenceId string `json:"sequence_id"` Timestamp time.Time `json:"timestamp"` AppName string `json:"app_name"` Channel string `json:"channel"` Done bool `json:"done"` HandlerName string `json:"handler_name"` MessageId string `json:"message_id"` }
EventItem includes metadata for /events api endpoint
type EventLog ¶ added in v0.13.0
type EventLog struct { StartTimestamp time.Time `json:"start_timestamp"` EndTimestamp time.Time `json:"end_timestamp"` EventItems []EventItem `json:"event_items"` }
EventLog is a list of events with search start and search end timestamps
type EventsClient ¶ added in v0.13.0
type HTTPAppConf ¶ added in v0.13.0
type HTTPAppConf struct {
Serve bool
}
type HTTPServer ¶ added in v0.13.0
type HTTPServer struct {
// contains filtered or unexported fields
}
func NewHTTPServer ¶ added in v0.13.0
func NewHTTPServer(addr string, automationsLoader *AutomationsLoader, natsClient *nats.Client, logger zerolog.Logger) (*HTTPServer, error)
func (*HTTPServer) Serve ¶ added in v0.13.0
func (h *HTTPServer) Serve() error
type HTTPServerConf ¶ added in v0.13.0
type HopsServer ¶
type HopsServer struct { HopsPath string KeyFilePath string Logger zerolog.Logger ReplayEvent string Watch bool HTTPServerConf HTTPAppConf K8sAppConf RunnerConf // contains filtered or unexported fields }
type K8sAppConf ¶ added in v0.13.0
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) SequenceCallback ¶ added in v0.13.0
type RunnerConf ¶ added in v0.13.0
type Schedule ¶ added in v0.13.0
type Schedule struct { Config *dsl.ScheduleAST CronSchedule cron.Schedule // contains filtered or unexported fields }