Documentation ¶
Overview ¶
Package poller implments a simple poller for the weather service. It consists of a Pulse worker that periodically calls the weather service to retrieve the weather forecast for given US cities.
Index ¶
- type Service
- func (svc *Service) AddLocation(ctx context.Context, p *genpoller.CityAndState) error
- func (svc *Service) AddWorker(ctx context.Context) (*genpoller.Worker, error)
- func (svc *Service) RemoveWorker(ctx context.Context) error
- func (svc *Service) Status(ctx context.Context) (*genpoller.PollerStatus, error)
- func (svc *Service) Stop(ctx context.Context) error
- func (svc *Service) Subscribe(ctx context.Context, location *genpoller.CityAndState, ...) error
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the poller service implementation.
func New ¶
func New(ctx context.Context, nominatimc nominatim.Client, weatherc weathergov.Client, rdb *redis.Client) (*Service, error)
New instantiates a new poller service.
func (*Service) AddLocation ¶
AddJob adds a new job to the poller worker pool.
func (*Service) RemoveWorker ¶
RemoveWorker removes a worker from the poller worker pool.
func (*Service) Subscribe ¶
func (svc *Service) Subscribe(ctx context.Context, location *genpoller.CityAndState, sub genpoller.SubscribeServerStream) error
Subscribe subscribes to forecasts for the given location.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker is the type that implements the Pulse worker interface.
func NewWorker ¶
func NewWorker(ctx context.Context, updateStream *streaming.Stream, nominatimc nominatim.Client, weatherc weathergov.Client) *Worker
New returns a new poller.
Directories ¶
Path | Synopsis |
---|---|
clients
|
|
weathergov
Package weathergov provides a client for the Weather.gov API described at https://www.weather.gov/documentation/services-web-api#
|
Package weathergov provides a client for the Weather.gov API described at https://www.weather.gov/documentation/services-web-api# |
cmd
|
|
gen
|
|
Click to show internal directories.
Click to hide internal directories.