utils

package
v1.2.1-0...-f94cca8 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyValueBootstrap = "bootstrap"
)
View Source
const (
	Tracer = `` /* 12995-byte string literal not displayed */

)

Variables

View Source
var (
	ErrStopTopicUtil = fmt.Errorf("stop")
)

Functions

func CommonAddressHexRepair

func CommonAddressHexRepair(address *common.Address) string

Types

type CounterID

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

func NewCounterID

func NewCounterID() *CounterID

func (*CounterID) Add

func (c *CounterID) Add(v string, delta int64)

func (*CounterID) Clone

func (c *CounterID) Clone() map[string]int64

func (*CounterID) Inc

func (c *CounterID) Inc(v string)

type Iterator

type Iterator struct{ Err error }

Iterator does nothing

func (*Iterator) Error

func (it *Iterator) Error() error

Error returns any errors

func (*Iterator) Key

func (*Iterator) Key() []byte

Key returns nil

func (*Iterator) Next

func (*Iterator) Next() bool

Next returns false

func (*Iterator) Release

func (*Iterator) Release()

Release does nothing

func (*Iterator) Value

func (*Iterator) Value() []byte

Value returns nil

type ListenCloser

type ListenCloser interface {
	Listen() error
	Close() error
}

ListenCloser listens for messages until it's asked to close

type ListenCloserFactory

type ListenCloserFactory func(*services.Control, cfg.Config, int, int) ListenCloser

type NoopBatch

type NoopBatch struct{}

NoopBatch does nothing

func (*NoopBatch) Delete

func (*NoopBatch) Delete([]byte) error

Delete returns nil

func (*NoopBatch) Inner

func (b *NoopBatch) Inner() database.Batch

Inner returns itself

func (*NoopBatch) Put

func (*NoopBatch) Put(_, _ []byte) error

Put returns nil

func (*NoopBatch) Replay

Replay does nothing

func (*NoopBatch) Reset

func (*NoopBatch) Reset()

Reset does nothing

func (*NoopBatch) ValueSize

func (*NoopBatch) ValueSize() int

ValueSize returns 0

func (*NoopBatch) Write

func (*NoopBatch) Write() error

Write returns nil

type NoopDatabase

type NoopDatabase struct{}

NoopDatabase is a lightning fast key value store with probabilistic operations.

func (*NoopDatabase) Close

func (*NoopDatabase) Close() error

Close returns nil

func (*NoopDatabase) Compact

func (*NoopDatabase) Compact(_, _ []byte) error

Compact returns nil

func (*NoopDatabase) Delete

func (*NoopDatabase) Delete([]byte) error

Delete returns nil

func (*NoopDatabase) Get

func (*NoopDatabase) Get([]byte) ([]byte, error)

Get returns nil, error

func (*NoopDatabase) Has

func (*NoopDatabase) Has([]byte) (bool, error)

Has returns false, nil

func (*NoopDatabase) NewBatch

func (*NoopDatabase) NewBatch() database.Batch

NewBatch returns a new batch

func (*NoopDatabase) NewIterator

func (*NoopDatabase) NewIterator() database.Iterator

NewIterator returns a new empty iterator

func (*NoopDatabase) NewIteratorWithPrefix

func (*NoopDatabase) NewIteratorWithPrefix([]byte) database.Iterator

NewIteratorWithPrefix returns a new empty iterator

func (*NoopDatabase) NewIteratorWithStart

func (*NoopDatabase) NewIteratorWithStart([]byte) database.Iterator

NewIteratorWithStart returns a new empty iterator

func (*NoopDatabase) NewIteratorWithStartAndPrefix

func (db *NoopDatabase) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator

NewIteratorWithStartAndPrefix returns a new empty iterator

func (*NoopDatabase) Put

func (*NoopDatabase) Put(_, _ []byte) error

Put returns nil

func (*NoopDatabase) Stat

func (*NoopDatabase) Stat(string) (string, error)

Stat returns an error

type TopicUtil

type TopicUtil interface {
	Partitions(ctx context.Context) (map[int]kafka.PartitionOffsets, error)
	Consume(brokers []string, offset int64, maxBytes int, readTimeout time.Duration, accept func(kafka.Message) error, partitions []int) error
	Close()
}

func NewTopicUtil

func NewTopicUtil(addr net.Addr, timeout time.Duration, topicName string) TopicUtil

type UniqueID

type UniqueID interface {
	Get(id string) (bool, error)
	Put(id string) error
}

func NewMemoryUniqueID

func NewMemoryUniqueID() UniqueID

type Worker

type Worker interface {
	Enque(job interface{})
	Finish(sleepTime time.Duration)
	JobCnt() int64
	IsFinished() bool
}

func NewWorker

func NewWorker(queueSize int, queueCnt int, processor func(int, interface{})) Worker

Jump to

Keyboard shortcuts

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