util

package
v0.0.0-...-5265a8e Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BUFFER_SIZE = 1024 * 512
)
View Source
const (
	MessageEOF = math.MinInt32
)

Variables

This section is empty.

Functions

func Compress

func Compress(buf []byte, compressType CompressType) []byte

func CompressGzip

func CompressGzip(buf []byte) []byte

Compress using Gzip

func CompressSnappy

func CompressSnappy(buf []byte) []byte

Compress using Snappy

func CopyBuffer

func CopyBuffer(src io.Reader, dst io.Writer) (err error)

func DuplicateName

func DuplicateName(name string) string

func GetHostFromAddress

func GetHostFromAddress(address string) string

func GetPortFromAddress

func GetPortFromAddress(address string) int32

func OpenDBConn

func OpenDBConn(driverName string, dbURI string) (*sql.DB, error)

func ReadMessage

func ReadMessage(reader io.Reader) (res []byte, err error)

func ReadObject

func ReadObject(reader io.Reader, obj interface{}) error

func Uncompress

func Uncompress(buf []byte, compressType CompressType) ([]byte, error)

func UncompressGzip

func UncompressGzip(buf []byte) ([]byte, error)

Uncompress using Gzip

func UncompressSnappy

func UncompressSnappy(buf []byte) ([]byte, error)

Uncompress using Snappy

func WriteEOFMessage

func WriteEOFMessage(writer io.Writer) (err error)

func WriteMessage

func WriteMessage(writer io.Writer, msg []byte) (err error)

func WriteObject

func WriteObject(writer io.Writer, obj interface{}) error

Types

type CompressType

type CompressType int32
const (
	UNCOMPRESSED CompressType = iota
	GZIP
	SNAPPY
)

type Heap

type Heap struct {
	Items    []*Item
	AgentMap map[string]pb.Location
}

func NewHeap

func NewHeap() *Heap

func (*Heap) GetAgents

func (self *Heap) GetAgents() []pb.Location

func (*Heap) GetExecutorLoc

func (self *Heap) GetExecutorLoc() pb.Location

func (Heap) Len

func (self Heap) Len() int

func (Heap) Less

func (self Heap) Less(i, j int) bool

func (*Heap) Pop

func (self *Heap) Pop() interface{}

func (*Heap) Push

func (self *Heap) Push(item interface{})

func (Heap) Swap

func (self Heap) Swap(i, j int)

type Item

type Item struct {
	Location       pb.Location
	ExecutorNumber int
}

func NewItem

func NewItem(loc pb.Location, num int) *Item

type Piper

type Piper struct {
	Reader *io.PipeReader
	Writer *io.PipeWriter
}

func NewPiper

func NewPiper() *Piper

Jump to

Keyboard shortcuts

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