types - ActiveState ActiveGo 1.8

Package types

import "github.com/coreos/etcd/pkg/types"

Overview ▾

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

func NewThreadsafeSet

func NewThreadsafeSet(values ...string) *tsafeSet

func NewUnsafeSet

func NewUnsafeSet(values ...string) *unsafeSet

type ID

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

type ID uint64

func IDFromString

func IDFromString(s string) (ID, error)

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

func (ID) String

func (i ID) String() string

type IDSlice

IDSlice implements the sort interface

type IDSlice []ID

func (IDSlice) Len

func (p IDSlice) Len() int

func (IDSlice) Less

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

func (IDSlice) Swap

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

type Set

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

type URLs

type URLs []url.URL

func MustNewURLs

func MustNewURLs(strs []string) URLs

func NewURLs

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

func (URLs) Len

func (us URLs) Len() int

func (URLs) Less

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

func (*URLs) Sort

func (us *URLs) Sort()

func (URLs) String

func (us URLs) String() string

func (URLs) StringSlice

func (us URLs) StringSlice() []string

func (URLs) Swap

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

type URLsMap

URLsMap is a map from a name to its URLs.

type URLsMap map[string]URLs

func NewURLsMap

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=,mach0=,mach1=,mach2=

func NewURLsMapFromStringMap

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

func (c URLsMap) Len() int

Len returns the size of URLsMap.

func (URLsMap) String

func (c URLsMap) String() string

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

func (URLsMap) URLs

func (c URLsMap) URLs() []string

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

type Uint64Slice

Uint64Slice implements sort interface

type Uint64Slice []uint64

func (Uint64Slice) Len

func (p Uint64Slice) Len() int

func (Uint64Slice) Less

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

func (Uint64Slice) Swap

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