http

package
v0.0.0-...-97a8816 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPEvents

type HTTPEvents struct {
	Endpoint string
	// contains filtered or unexported fields
}

func NewHTTPEvents

func NewHTTPEvents(client *httpCore.Client, endpoint string, ctxProducer func() (ctx context.Context, canceller func()), refreshRate time.Duration) *HTTPEvents

NewHTTPEvents makes an EventProducer which creates events by pinging an external HTTP API for updates periodically. If refreshRate is negative, then the data will never be refreshed.

It expects the following endpoint to exist remotely:

GET {endpoint}

-- Returns all the known Stored Requests and Stored Imps.

GET {endpoint}?last-modified={timestamp}

-- Returns the Stored Requests and Stored Imps which have been updated since the last timestamp.
   This timestamp will be sent in the rfc3339 format, using UTC and no timezone shift.
   For more info, see: https://tools.ietf.org/html/rfc3339

The responses should be JSON like this:

{
  "requests": {
    "request1": { ... stored request data ... },
    "request2": { ... stored request data ... },
    "request3": { ... stored request data ... },
  },
  "imps": {
    "imp1": { ... stored data for imp1 ... },
    "imp2": { ... stored data for imp2 ... },
  }
}

To signal deletions, the endpoint may return { "deleted": true } in place of the Stored Data if the "last-modified" param existed.

func (*HTTPEvents) Invalidations

func (e *HTTPEvents) Invalidations() <-chan events.Invalidation

func (*HTTPEvents) Saves

func (e *HTTPEvents) Saves() <-chan events.Save

Jump to

Keyboard shortcuts

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