nutcracker

package
v0.0.0-...-4c3ecd7 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API represents a nutcracker API

func NewAPI

func NewAPI(creds *Creds, server string) *API

NewAPI returns a new nutcracker API. If creds are nil, an unauthenticated request will be made.

func (*API) Delete

func (a *API) Delete(path string) (response []byte, err error)

Delete sents a DELETE request

func (*API) Get

func (a *API) Get(path string) (response []byte, err error)

Get sents a GET request

func (*API) Post

func (a *API) Post(path string, data APIReq) (response []byte, err error)

Post sends a POST request

type APIReq

type APIReq map[string]interface{}

APIReq is a convenient way of passing a request

func NewAPIReq

func NewAPIReq() APIReq

NewAPIReq returns a new APIReq

func (APIReq) Set

func (a APIReq) Set(key string, value interface{}) APIReq

Set sets a value in a request.

type Creds

type Creds struct {
	Username string
	Password string
	Admin    bool `json:"-"`
}

Creds is an interface to send credentials

type MetricVal

type MetricVal struct {
	Keys    int
	Secrets int
	Views   int
	Sealed  bool
	// contains filtered or unexported fields
}

type Metrics

type Metrics struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMetrics

func NewMetrics(server string) (m *Metrics)

NewMetrics creates a new metric poller

func (*Metrics) Latest

func (m *Metrics) Latest() MetricVal

Latest returns the latest metric data set

func (*Metrics) Update

func (m *Metrics) Update() (err error)

Update updates the metric data from the server

Jump to

Keyboard shortcuts

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