chrysom

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 15 Imported by: 7

Documentation

Overview

Package chrysom provides a client in order to interact with argus.

Index

Constants

View Source
const (
	SuccessOutcome  = "success"
	FailureOutcomme = "failure"
)

Label Values

View Source
const (
	OutcomeLabel = "outcome"
)

Labels

View Source
const (
	PollCounter = "chrysom_polls_total"
)

Names

Variables

This section is empty.

Functions

func Metrics added in v0.3.5

func Metrics() []xmetrics.Metric

Metrics returns the Metrics relevant to this package

Types

type Auth

type Auth struct {
	JWT   acquire.RemoteBearerTokenAcquirerOptions
	Basic string
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func CreateClient

func CreateClient(config ClientConfig) (*Client, error)

func (*Client) GetItems

func (c *Client) GetItems(owner string) ([]model.Item, error)

func (*Client) Push

func (c *Client) Push(item model.Item, owner string) (string, error)

func (*Client) Remove

func (c *Client) Remove(id string, owner string) (model.Item, error)

func (*Client) Start added in v0.3.5

func (c *Client) Start(ctx context.Context) error

func (*Client) Stop

func (c *Client) Stop(ctx context.Context) error

func (*Client) Update added in v0.3.7

func (c *Client) Update(item model.Item, id string, owner string) (string, error)

type ClientConfig

type ClientConfig struct {
	HTTPClient      *http.Client
	Bucket          string
	PullInterval    time.Duration
	Address         string
	Auth            Auth
	DefaultTTL      int64
	MetricsProvider provider.Provider
	Logger          log.Logger
	Listener        Listener
}

type ConfigureListener

type ConfigureListener interface {
	// SetListener will attempt to set the lister.
	SetListener(listener Listener) error
}

type Listener

type Listener interface {
	// Update is called when we get changes to our item listeners with either
	// additions, or updates.
	//
	// The list of hooks must contain only the current items.
	Update(items []model.Item)
}

type ListenerFunc

type ListenerFunc func(items []model.Item)

func (ListenerFunc) Update

func (listener ListenerFunc) Update(items []model.Item)

type Option

type Option func(r *storeConfig)

Option is the function used to configure a store.

func WithListener

func WithListener(listener Listener) Option

WithListener sets a Listener to use for the store.

func WithLogger

func WithLogger(logger log.Logger) Option

WithLogger sets a logger to use for the store.

func WithStorage

func WithStorage(pusher Pusher) Option

WithStorage sets a Pusher to use for the store.

type PushReader added in v0.3.3

type PushReader interface {
	Pusher
	Reader
}

type Pusher

type Pusher interface {
	// Push applies user configurable for registering an item returning the id
	// i.e. updated the storage with said item.
	Push(item model.Item, owner string) (string, error)

	// Remove will remove the item from the store
	Remove(id string, owner string) (model.Item, error)
}

type Reader

type Reader interface {
	// GeItems will return all the current items or an error.
	GetItems(owner string) ([]model.Item, error)

	Start(ctx context.Context) error

	// Stop will stop all threads and cleanup any necessary resources
	Stop(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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