collections

package
v0.0.0-...-cb472e6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer interface {
	// Analyze analyzes message from collectors.
	Analyze(message *string) error

	// Hash returns a hash value of the input message string.
	Hash(cloudid, ip string) (string, error)

	// Mock returns mock message that could be analyzed by the Analyzer.
	Mock() string
}

Analyzer is common collection analyzer interface.

type Hash

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

Hash is data hash that updates target nodes in dynamic mode, and calculates node base on hash key of data.

func NewHash

func NewHash(ip string, port uint, discovery discovery.DiscoveryInterface) *Hash

NewHash creates a new hash object with local node hash value.

func (*Hash) IsMatch

func (h *Hash) IsMatch(hash string) bool

IsMatch matchs hash key base on dynamic hashring values, and return a bool that marks if the data hash is matched the local node.

type Porter

type Porter interface {
	// Name returns name of the Porter.
	Name() string

	// Run runs the Porter.
	Run() error

	// Mock supports mock service in Porter.
	Mock() error
}

Porter is common porter interface. It handles message from collectors base on Analyzer.

type PorterManager

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

PorterManager manages the collection porters.

func NewPorterManager

func NewPorterManager() *PorterManager

NewPorterManager creates a new PorterManager object.

func (*PorterManager) AddPorter

func (mgr *PorterManager) AddPorter(p Porter) error

AddPorter adds and runs a new porter.

func (*PorterManager) Run

func (mgr *PorterManager) Run() error

Run runs the new PorterManager.

type SimplePorter

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

SimplePorter is simple porter handles message from collectors. You can impls your own Porter base on Porter and Analyzer interfaces.

func NewSimplePorter

func NewSimplePorter(name string, engine *backbone.Engine, hash *Hash, analyzer Analyzer,
	redisCli *redis.Client, topics []string, registry prometheus.Registerer) *SimplePorter

NewSimplePorter creates a new SimplePorter object.

func (*SimplePorter) AddMessage

func (p *SimplePorter) AddMessage(message *string) error

Mock handles a mock message.

func (*SimplePorter) Mock

func (p *SimplePorter) Mock() error

Mock handles a mock message.

func (*SimplePorter) Name

func (p *SimplePorter) Name() string

Name returns name of this porter.

func (*SimplePorter) Run

func (p *SimplePorter) Run() error

Run runs the porter.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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