etcd: github.com/etcd-io/etcd/pkg/types Index | Files

package types

import "github.com/etcd-io/etcd/pkg/types"

Package types declares various data types and implements type-checking functions.

Index

Package Files

doc.go id.go set.go slice.go urls.go urlsmap.go

func NewThreadsafeSet Uses

func NewThreadsafeSet(values ...string) *tsafeSet

func NewUnsafeSet Uses

func NewUnsafeSet(values ...string) *unsafeSet

type ID Uses

type ID uint64

ID represents a generic identifier which is canonically stored as a uint64 but is typically represented as a base-16 string for input/output

func IDFromString Uses

func IDFromString(s string) (ID, error)

IDFromString attempts to create an ID from a base-16 string.

func (ID) String Uses

func (i ID) String() string

type IDSlice Uses

type IDSlice []ID

IDSlice implements the sort interface

func (IDSlice) Len Uses

func (p IDSlice) Len() int

func (IDSlice) Less Uses

func (p IDSlice) Less(i, j int) bool

func (IDSlice) Swap Uses

func (p IDSlice) Swap(i, j int)

type Set Uses

type Set interface {
    Add(string)
    Remove(string)
    Contains(string) bool
    Equals(Set) bool
    Length() int
    Values() []string
    Copy() Set
    Sub(Set) Set
}

type URLs Uses

type URLs []url.URL

func MustNewURLs Uses

func MustNewURLs(strs []string) URLs

func NewURLs Uses

func NewURLs(strs []string) (URLs, error)

func (URLs) Len Uses

func (us URLs) Len() int

func (URLs) Less Uses

func (us URLs) Less(i, j int) bool

func (*URLs) Sort Uses

func (us *URLs) Sort()

func (URLs) String Uses

func (us URLs) String() string

func (URLs) StringSlice Uses

func (us URLs) StringSlice() []string

func (URLs) Swap Uses

func (us URLs) Swap(i, j int)

type URLsMap Uses

type URLsMap map[string]URLs

URLsMap is a map from a name to its URLs.

func NewURLsMap Uses

func NewURLsMap(s string) (URLsMap, error)

NewURLsMap returns a URLsMap instantiated from the given string, which consists of discovery-formatted names-to-URLs, like: mach0=http://1.1.1.1:2380,mach0=http://2.2.2.2::2380,mach1=http://3.3.3.3:2380,mach2=http://4.4.4.4:2380

func NewURLsMapFromStringMap Uses

func NewURLsMapFromStringMap(m map[string]string, sep string) (URLsMap, error)

NewURLsMapFromStringMap takes a map of strings and returns a URLsMap. The string values in the map can be multiple values separated by the sep string.

func (URLsMap) Len Uses

func (c URLsMap) Len() int

Len returns the size of URLsMap.

func (URLsMap) String Uses

func (c URLsMap) String() string

String turns URLsMap into discovery-formatted name-to-URLs sorted by name.

func (URLsMap) URLs Uses

func (c URLsMap) URLs() []string

URLs returns a list of all URLs. The returned list is sorted in ascending lexicographical order.

type Uint64Slice Uses

type Uint64Slice []uint64

Uint64Slice implements sort interface

func (Uint64Slice) Len Uses

func (p Uint64Slice) Len() int

func (Uint64Slice) Less Uses

func (p Uint64Slice) Less(i, j int) bool

func (Uint64Slice) Swap Uses

func (p Uint64Slice) Swap(i, j int)

Package types imports 9 packages (graph). Updated 2019-08-18. Refresh now. Tools for package owners.