client

package
v0.0.0-...-6f9d76d Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("timeout")

ErrTimeout is returned when we cannot obtain an exclusive lock on the key file.

View Source
var Version string = "devel"

Version represents the compiled version of the client binary. It can be overridden at compile time with: `go build -ldflags "-X github.com/pinterest/knox/client.Version=1.2.3" github.com/pinterest/knox/cmd/dev_client` In the above example, knox version would give you `1.2.3`. By default, the version is `devel`.

Functions

func Run

func Run(client knox.APIClient, p *VisibilityParams, tokenEndpoint, clientID string)

Run is how to execute commands. It uses global variables and isn't safe to call in parallel.

Types

type Command

type Command struct {
	// Run runs the command.
	// The args are the arguments after the command name.
	Run func(cmd *Command, args []string)

	// UsageLine is the one-line usage message.
	// The first word in the line is taken to be the command name.
	UsageLine string

	// Short is the short description shown in the 'go help' output.
	Short string

	// Long is the long message shown in the 'go help <this-command>' output.
	Long string

	// Flag is a set of flags specific to this command.
	Flag flag.FlagSet

	// CustomFlags indicates that the command will do its own
	// flag parsing.
	CustomFlags bool
}

A Command is an implementation of a go command like go build or go fix.

func (*Command) Name

func (c *Command) Name() string

Name returns the command's name: the first word in the usage line.

func (*Command) Runnable

func (c *Command) Runnable() bool

Runnable reports whether the command can be run; otherwise it is a documentation pseudo-command such as importpath.

func (*Command) Usage

func (c *Command) Usage()

Usage prints the help string for a command.

type Keys

type Keys interface {
	Get() ([]string, error)
	Add([]string) error
	Overwrite([]string) error
	Remove([]string) error
	Lock() error
	Unlock() error
}

Keys are an interface for storing a list of key ids (for use with the register file to provide locks)

func NewKeysFile

func NewKeysFile(fn string) Keys

NewKeysFile takes in a filename and outputs an implementation of the Keys interface

type KeysFile

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

KeysFile is an implementation of Keys based on the file system for the register file.

func (*KeysFile) Add

func (k *KeysFile) Add(ks []string) error

Add will add the key IDs to the list. It expects Lock to have been called.

func (*KeysFile) Get

func (k *KeysFile) Get() ([]string, error)

Get will get the list of key ids. It expects Lock to have been called.

func (*KeysFile) Lock

func (k *KeysFile) Lock() error

Lock performs the nonblocking syscall lock and retries until the global timeout is met.

func (*KeysFile) Overwrite

func (k *KeysFile) Overwrite(ks []string) error

Overwrite deletes all existing values in the key list and writes the input. It expects Lock to have been called.

func (*KeysFile) Remove

func (k *KeysFile) Remove(ks []string) error

Remove will remove the input key ids from the list. It expects Lock to have been called.

func (*KeysFile) Unlock

func (k *KeysFile) Unlock() error

Unlock performs the nonblocking syscall unlock and retries until the global timeout is met.

type VisibilityParams

type VisibilityParams struct {
	Logf    func(string, ...interface{})
	Errorf  func(string, ...interface{})
	Metrics func(map[string]uint64)
}

VisibilityParams exposes functions for the knox client to provide information

Jump to

Keyboard shortcuts

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