types

package
v3.2.26+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewThreadsafeSet

func NewThreadsafeSet(values ...string) *tsafeSet

func NewUnsafeSet

func NewUnsafeSet(values ...string) *unsafeSet

Types

type ID

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

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

type IDSlice []ID

IDSlice implements the sort interface

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 {
	Add(string)
	Remove(string)
	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

type URLsMap map[string]URLs

URLsMap is a map from a name to its 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=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

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

type Uint64Slice []uint64

Uint64Slice implements sort interface

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)

Jump to

Keyboard shortcuts

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