Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGetEndpoint ¶
NewGetEndpoint returns the endpoint for /norns/{id} handler.
func NewGetEndpointDecode ¶
func NewGetEndpointDecode() kithttp.DecodeRequestFunc
NewGetEndpointDecode returns DecodeRequestFunc wrapper from the /norns/{id} endpoint.
Types ¶
type Filterer ¶ added in v0.2.0
type Filterer interface { // Start begins pulling from the filter queue to deliver events. Start(context.Context) error // Filter checks if the event's deviceID matches deviceID of norn // and queue it accordingly. Filter(deviceID string, event *wrp.Message) // Update will update the time a norn expires. Update(norn model.Norn) // Stop closes the filter queue and resets its metric. Stop(context.Context) error }
Filterer is used to filter events by deviceID.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is in charge of fanning out events to its respective dispatcher (HTTP or Sqs). It keeps track of all recent Filterers and Dispatchers part of its map and is responsible for updating or removing them.
func NewManager ¶
func NewManager(sc dispatch.SenderConfig, transport http.RoundTripper, logger log.Logger, measures dispatch.Measures) (*Manager, error)
NewManager constructs a Manager from the provided configs.
func (*Manager) Send ¶
Send will send the message to Filter for it to be checked if norn's deviceID matches the event's.
func (*Manager) Update ¶
Update is the argus chrysom client listener. For every recent item that is provided by argus, Update will check if the dispatcher and filter for an item already exists as part of the manager's local cache (idFilter and urlDispatcher maps) and update cache with the recent norn retrieved from item. If the norn is brand new, a new dispatcher and filter is created for it and added to local cache. Any old dispatchers and filters is also removed part of Update.