etcd

package module
v0.0.0-...-d860a0e Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client holds the etcd connection

func (*Client) DeleteKnot

func (c *Client) DeleteKnot(ip, port string) error

DeleteKnot removes a knot and also keys from wings:

func (*Client) DeletePubkey

func (c *Client) DeletePubkey(pubkey string) error

DeletePubkey receives a string and deletes public key by prefix it also deletes the public key from the wings

func (*Client) DeleteWing

func (c *Client) DeleteWing(name string) error

func (*Client) GetAllKnots

func (c *Client) GetAllKnots(knots *[]Knot) error

GetAllKnots always returns all knots, or error

func (*Client) GetAllPubkeys

func (c *Client) GetAllPubkeys(pubkeys *[]Pubkey) error

GetAllPubkeys receives a pointer to a slice and fills it up with all public keys

func (*Client) GetAllWings

func (c *Client) GetAllWings(wings *[]Wing) error

func (*Client) GetKnot

func (c *Client) GetKnot(ip, port string) (Knot, error)

GetKnot returns all keys belonging to a knot in the database keys will always start with "knot:"

func (*Client) GetPubkey

func (c *Client) GetPubkey(pubkey string) (Pubkey, error)

GetPubkey receives a string and returns the pubkey or an error

func (*Client) GetWing

func (c *Client) GetWing(name string) (Wing, error)

func (*Client) InitDB

func (c *Client) InitDB()

InitDB starts the connection to etcd

func (*Client) PutKnot

func (c *Client) PutKnot(knot Knot) error

PutKnot validates the IP and after that adds the knot in the DB If a knot already exists for the IP:Port combination, it returns error

func (*Client) PutPubkey

func (c *Client) PutPubkey(pubkey Pubkey) error

PutPubkey allows you to add a public key to the database The function also adds the wing to prefix "wings:" The public key must be unique so an error is returned if it is found in the DB

type KVPair

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

KVPair can be used to send data at etcd

type Knot

type Knot struct {
	IP            string
	Port          string
	Name          string
	Wings         []string
	BootTimestamp time.Time
}

Knot holds informaton

func (Knot) GetIPPort

func (k Knot) GetIPPort() string

GetIPPort is used when you need IP.Port This function is here so that you see that we use . instead of :

type Pubkey

type Pubkey struct {
	Pubkey string
	Owner  string
	Wings  []string
}

Pubkey struct hold information about a public key wings are just a slice of strings

type Wing

type Wing struct {
	Name    string
	Pubkeys []string
	Knots   []string
}

Jump to

Keyboard shortcuts

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