chrysom

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2020 License: Apache-2.0 Imports: 12 Imported by: 7

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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, options ...Option) (*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) SetListener

func (c *Client) SetListener(listener Listener) error

func (*Client) Stop

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

type ClientConfig

type ClientConfig struct {
	HttpClient   *http.Client
	Bucket       string
	PullInterval time.Duration
	Address      string
	Auth         Auth
	DefaultTTL   int64
}

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 (listner 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)

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

type Reader

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

Jump to

Keyboard shortcuts

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