This section is empty.


View Source
var (

	// ErrNotFound is returned by ConsulClient.Get
	ErrNotFound = fmt.Errorf("Not found")
View Source
var ErrUserIDNotFound = fmt.Errorf("User ID not found")

    ErrUserIDNotFound should be returned by a UserIDer when it fails to ID the user for a request.


    func NewConsulPipeRouter

    func NewConsulPipeRouter(client ConsulClient, prefix, advertise string, userIDer UserIDer) app.PipeRouter

      NewConsulPipeRouter returns a new consul based router

      func NewSQSControlRouter

      func NewSQSControlRouter(config *aws.Config, userIDer UserIDer, prefix string, rpcTimeout time.Duration) app.ControlRouter

        NewSQSControlRouter the harbinger of death

        func NoopUserIDer

        func NoopUserIDer(context.Context) (string, error)

          NoopUserIDer always returns the empty user ID.


          type AWSCollector

          type AWSCollector interface {
          	CreateTables() error

            AWSCollector is a Collector which can also CreateTables

            func NewAWSCollector

            func NewAWSCollector(config AWSCollectorConfig) (AWSCollector, error)

              NewAWSCollector the elastic reaper of souls

              type AWSCollectorConfig

              type AWSCollectorConfig struct {
              	UserIDer       UserIDer
              	DynamoDBConfig *aws.Config
              	DynamoTable    string
              	S3Store        *S3Store
              	NatsHost       string
              	MemcacheClient *MemcacheClient
              	Window         time.Duration
              	MaxTopNodes    int

                AWSCollectorConfig has everything we need to make an AWS collector.

                type BillingEmitter

                type BillingEmitter struct {
                	// contains filtered or unexported fields

                  BillingEmitter is the billing emitter

                  func NewBillingEmitter

                  func NewBillingEmitter(upstream app.Collector, billingClient *billing.Client, cfg BillingEmitterConfig) (*BillingEmitter, error)

                    NewBillingEmitter changes a new billing emitter which emits billing events

                    func (*BillingEmitter) Add

                    func (e *BillingEmitter) Add(ctx context.Context, rep report.Report, buf []byte) error

                      Add implements app.Collector

                      func (*BillingEmitter) Close

                      func (e *BillingEmitter) Close() error

                        Close shuts down the billing emitter and billing client flushing events.

                        type BillingEmitterConfig

                        type BillingEmitterConfig struct {
                        	Enabled         bool
                        	DefaultInterval time.Duration
                        	UserIDer        UserIDer

                          BillingEmitterConfig has everything we need to make a billing emitter

                          func (*BillingEmitterConfig) RegisterFlags

                          func (cfg *BillingEmitterConfig) RegisterFlags(f *flag.FlagSet)

                            RegisterFlags registers the billing emitter flags with the main flag set.

                            type CASCallback

                            type CASCallback func(in interface{}) (out interface{}, retry bool, err error)

                              CASCallback is the type of the callback to CAS. If err is nil, out must be non-nil.

                              type ConsulClient

                              type ConsulClient interface {
                              	Get(key string, out interface{}) error
                              	CAS(key string, out interface{}, f CASCallback) error
                              	WatchPrefix(prefix string, out interface{}, done chan struct{}, f func(string, interface{}) bool)

                                ConsulClient is a high-level client for Consul, that exposes operations such as CAS and Watch which take callbacks. It also deals with serialisation.

                                func NewConsulClient

                                func NewConsulClient(addr string) (ConsulClient, error)

                                  NewConsulClient returns a new ConsulClient

                                  type MemcacheClient

                                  type MemcacheClient struct {
                                  	// contains filtered or unexported fields

                                    MemcacheClient is a memcache client that gets its server list from SRV records, and periodically updates that ServerList.

                                    func NewMemcacheClient

                                    func NewMemcacheClient(config MemcacheConfig) *MemcacheClient

                                      NewMemcacheClient creates a new MemcacheClient that gets its server list from SRV and updates the server list on a regular basis.

                                      func (*MemcacheClient) FetchReports

                                      func (c *MemcacheClient) FetchReports(ctx context.Context, keys []string) (map[string]report.Report, []string, error)

                                        FetchReports gets reports from memcache.

                                        func (*MemcacheClient) Stop

                                        func (c *MemcacheClient) Stop()

                                          Stop the memcache client.

                                          func (*MemcacheClient) StoreReportBytes

                                          func (c *MemcacheClient) StoreReportBytes(ctx context.Context, key string, rpt []byte) (int, error)

                                            StoreReportBytes stores a report.

                                            type MemcacheConfig

                                            type MemcacheConfig struct {
                                            	Host             string
                                            	Service          string
                                            	Timeout          time.Duration
                                            	UpdateInterval   time.Duration
                                            	Expiration       time.Duration
                                            	CompressionLevel int

                                              MemcacheConfig defines how a MemcacheClient should be constructed.

                                              type ReportStore

                                              type ReportStore interface {
                                              	FetchReports(context.Context, []string) (map[string]report.Report, []string, error)

                                                ReportStore is a thing that we can get reports from.

                                                type S3Store

                                                type S3Store struct {
                                                	// contains filtered or unexported fields

                                                  S3Store is an S3 client that stores and retrieves Reports.

                                                  func NewS3Client

                                                  func NewS3Client(config *aws.Config, bucketName string) S3Store

                                                    NewS3Client creates a new S3 client.

                                                    func (*S3Store) FetchReports

                                                    func (store *S3Store) FetchReports(ctx context.Context, keys []string) (map[string]report.Report, []string, error)

                                                      FetchReports fetches multiple reports in parallel from S3.

                                                      func (*S3Store) StoreReportBytes

                                                      func (store *S3Store) StoreReportBytes(ctx context.Context, key string, buf []byte) (int, error)

                                                        StoreReportBytes stores a report.

                                                        type UserIDer

                                                        type UserIDer func(context.Context) (string, error)

                                                          UserIDer identifies users given a request context.

                                                          func UserIDHeader

                                                          func UserIDHeader(headerName string) UserIDer

                                                            UserIDHeader returns a UserIDer which a header by the supplied key.