util

package
v0.0.0-...-445f9a6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Net, _ = tableflip.New(tableflip.Options{UpgradeTimeout: tableflip.DefaultUpgradeTimeout})
	N      = Net.Fds
)
View Source
var (
	Workers = &workerGroup{}
)

Functions

func DialGRPC

func DialGRPC(ctx context.Context, proto, address string, timeout time.Duration, tlsConfig *tls.Config) (*grpc.ClientConn, error)

func GRPCListenAndServe

func GRPCListenAndServe(server *grpc.Server, proto, address string) error

func InitGraceUpgrade

func InitGraceUpgrade(exit context.CancelFunc, timeout time.Duration, sig os.Signal)

func NotifyWhenConfigChanged

func NotifyWhenConfigChanged(file string, out interface{}, unmarshalFunc func([]byte, interface{}) error) <-chan struct{}

func ScanAnyAvail

func ScanAnyAvail(data []byte, atEOF bool) (advance int, token []byte, err error)

ScanAnyAvail a split func to get all available bytes

func UnWatchFileWrite

func UnWatchFileWrite(file string) error

func Unmarshal

func Unmarshal(file string, out interface{}, unmarshalFunc func([]byte, interface{}) error) error

Types

type Command

type Command struct {
	Context context.Context
	Exit    context.CancelFunc
	cobra.Command
}

func DefaultCmd

func DefaultCmd(name string, optFromConfigFile interface{}, onConfigChanged func(interface{}), run func(context.Context, context.CancelFunc) error) *Command

type FileEventChan

type FileEventChan struct {
	Write chan struct{}
}

func WatchFileWrite

func WatchFileWrite(file string) (*FileEventChan, error)

type StringInterfaceMap

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

func (*StringInterfaceMap) Del

func (ss *StringInterfaceMap) Del(s string)

func (*StringInterfaceMap) Get

func (ss *StringInterfaceMap) Get(s string) (interface{}, bool)

func (*StringInterfaceMap) Set

func (ss *StringInterfaceMap) Set(s string, val interface{})

type Worker

type Worker func(sigContinue func()) (result interface{}, err error)

type WorkerChan

type WorkerChan struct {
	Continue chan struct{}
	Result   chan interface{}
	Error    chan error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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