etcd

package
v0.0.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyAlreadyExists - Testable error for when a key already exists
	ErrKeyAlreadyExists = errors.New("Key Already Exists")

	// ErrKeyMissing - testable error for no expected key defined
	ErrKeyMissing = errors.New("Key not defined")
)
View Source
var (
	// Timeout - For now a constant
	Timeout = 5 * time.Second

	// MaxTransactionTime - Also a constant - for now
	MaxTransactionTime = 120 * time.Second
)
View Source
var ExtKeyUsage = map[string]x509.ExtKeyUsage{
	"any":              x509.ExtKeyUsageAny,
	"server auth":      x509.ExtKeyUsageServerAuth,
	"client auth":      x509.ExtKeyUsageClientAuth,
	"code signing":     x509.ExtKeyUsageCodeSigning,
	"email protection": x509.ExtKeyUsageEmailProtection,
	"s/mime":           x509.ExtKeyUsageEmailProtection,
	"ipsec end system": x509.ExtKeyUsageIPSECEndSystem,
	"ipsec tunnel":     x509.ExtKeyUsageIPSECTunnel,
	"ipsec user":       x509.ExtKeyUsageIPSECUser,
	"timestamping":     x509.ExtKeyUsageTimeStamping,
	"ocsp signing":     x509.ExtKeyUsageOCSPSigning,
	"microsoft sgc":    x509.ExtKeyUsageMicrosoftServerGatedCrypto,
	"netscape sgc":     x509.ExtKeyUsageNetscapeServerGatedCrypto,
}

ExtKeyUsage - contains a mapping of string names to extended key usages.

Functions

func Delete

func Delete(cfg ClientConfig, key string) (err error)

Delete - will remove a key from etcd

func GenCerts

func GenCerts(cfg ServerConfig) (err error)

GenCerts - Will generate etcd server and client certs from appropriate CA and key

func Get

func Get(cfg ClientConfig, key string) (value string, err error)

Get - Will return: - The the string value for a given key if present - Will return an err for all other occasions

func GetLock

func GetLock(cfg ClientConfig, key string) (mylock bool, err error)

GetLock - Will obtain a lock (true) if the first client to create lock If TTL expired, will obtain lock (reset TTL) If TTL not expired will return false

func PutTx

func PutTx(cfg ClientConfig, key string, value string) (err error)

PutTx - Puts with a transaction (will NOT create new revision) Will ensure only a single version is ever stored. Returns error if key already existed

Types

type ClientConfig

type ClientConfig struct {
	Endpoints          string
	CaFileName         string
	ClientCertFileName string
	ClientKeyFileName  string
}

ClientConfig - represents a controller configuration.

type ServerConfig

type ServerConfig struct {
	CaKeyFileName      string
	ServerCertFileName string
	ServerKeyFileName  string
	PeerCertFileName   string
	PeerKeyFileName    string
	LocalHostNames     []string
	ClusterHostNames   []string
	ClientConfig       ClientConfig
}

ServerConfig - Params for configuring an etcd cluster

Jump to

Keyboard shortcuts

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