finder

package
v0.0.0-...-77d2b57 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FinderEchonet        = "echonet"
	FinderShared         = "shared"
	FinderStatic         = "static"
	FinderStaticToml     = "static_toml"
	FinderNodeCluster    = "cluster"
	FinderNodeName       = "name"
	FinderNodeAddress    = "address"
	FinderNodeRpcPort    = "rpc_port"
	FinderNodeCarbonPort = "carbon_port"
	FinderNodeRenderPort = "render_port"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Finder FinderConfig
}

type EchonetFinder

type EchonetFinder struct {
	*finder_echonet.EchonetController
	// contains filtered or unexported fields
}

EchonetFinder represents a base finder.

func (*EchonetFinder) ControllerMessageReceived

func (finder *EchonetFinder) ControllerMessageReceived(msg *uecho_protocol.Message)

func (*EchonetFinder) ControllerNewNodeFound

func (finder *EchonetFinder) ControllerNewNodeFound(echonetNode *uecho.RemoteNode)

func (EchonetFinder) GetAllNodes

func (finder EchonetFinder) GetAllNodes() ([]Node, error)

GetAllNodes returns all found nodes.

func (EchonetFinder) GetNeighborhoodNode

func (finder EchonetFinder) GetNeighborhoodNode(node Node) (Node, error)

GetNeighborhoodNode returns a neighborhood node of the specified node.

func (EchonetFinder) GetPrefixNodes

func (finder EchonetFinder) GetPrefixNodes(targetString string) ([]Node, error)

GetPrefixNodes returns only nodes matching with a specified start string.

func (EchonetFinder) GetRegexpNodes

func (finder EchonetFinder) GetRegexpNodes(re *regexp.Regexp) ([]Node, error)

GetRegexpNodes returns only nodes matching with a specified regular expression.

func (EchonetFinder) HasNode

func (finder EchonetFinder) HasNode(targetNode Node) bool

HasNode returns true when the specified node is added already, otherwise false.

func (*EchonetFinder) IsLocalNode

func (finder *EchonetFinder) IsLocalNode(candidateNode node.Node) bool

IsLocalNode returns true when the specified node is the local node, otherwise false.

func (*EchonetFinder) IsRunning

func (finder *EchonetFinder) IsRunning() bool

IsRunning returns true when the finder is running, otherwise false.

func (*EchonetFinder) Search

func (finder *EchonetFinder) Search() error

Search searches all nodes.

func (EchonetFinder) SetNotifyListener

func (finder EchonetFinder) SetNotifyListener(l FinderNotifyListener) error

SetSearchListener sets the search listener.

func (EchonetFinder) SetSearchListener

func (finder EchonetFinder) SetSearchListener(l FinderSearchListener) error

SetSearchListener sets the search listener.

func (*EchonetFinder) Start

func (finder *EchonetFinder) Start() error

Start starts the finder.

func (*EchonetFinder) Stop

func (finder *EchonetFinder) Stop() error

Stop stops the finder.

func (*EchonetFinder) String

func (finder *EchonetFinder) String() string

String returns the description.

type Finder

type Finder interface {
	// SearchAll searches all nodes.
	Search() error
	// SetSearchListener sets a specified listener.
	SetSearchListener(FinderSearchListener) error
	// SetNotifyListener sets a specified listener.
	SetNotifyListener(FinderNotifyListener) error
	// GetAllNodes returns all found nodes.
	GetAllNodes() ([]Node, error)
	// GetPrefixNodes returns only nodes matching with a specified start string.
	GetPrefixNodes(string) ([]Node, error)
	// GetRegexpNodes returns only nodes matching with a specified regular expression.
	GetRegexpNodes(*regexp.Regexp) ([]Node, error)
	// GetNeighborhoodNode returns a neighborhood node of the specified node.
	GetNeighborhoodNode(node Node) (Node, error)
	// Start starts the finder.
	Start() error
	// Stop stops the finder.
	Stop() error
	// IsRunning returns true when the finder is running, otherwise false.
	IsRunning() bool
	// String returns the description
	String() string
}

Finder represents an abstract interface.

func NewEchonetFinder

func NewEchonetFinder() Finder

NewEchonetFinder returns a new finder of Echonet.

func NewEchonetFinderWithLocalNode

func NewEchonetFinderWithLocalNode(node node.Node) Finder

NewEchonetFinderWithLocalNode returns a new finder with the specified node.

func NewFinder

func NewFinder() Finder

NewFinder returns a new finder.

func NewSharedFinder

func NewSharedFinder() Finder

NewSharedFinder returns a new shared finder.

func NewStaticFinderWithConfig

func NewStaticFinderWithConfig(config FinderConfig) Finder

NewStaticFinderWithConfig returns a new static finder with specified nodes.

func NewStaticFinderWithNodes

func NewStaticFinderWithNodes(nodes []Node) Finder

NewStaticFinderWithNodes returns a new static finder with specified nodes.

func NewStaticFinderWithTOML

func NewStaticFinderWithTOML(filename string) (Finder, error)

NewStaticFinderWithTOML returns a new static finder with specified nodes.

type FinderConfig

type FinderConfig struct {
	Hosts []string
}

type FinderNotifyListener

type FinderNotifyListener interface {
	FinderNotifyReceived(*Node)
}

FinderNotifyListener a listener for Finder.

type FinderSearchListener

type FinderSearchListener interface {
	FinderSearchResponseReceived(*Node)
}

FinderSearchListener a listener for Finder.

type Node

type Node = node.Node

type Regexp

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

Regexp represents a regexp for the finder.

func NewRegexp

func NewRegexp() *Regexp

NewRegexp returns a new regexp.

func (*Regexp) Compile

func (re *Regexp) Compile(expr string) error

Compile parses a regular expression.

func (*Regexp) CompileGraphite

func (re *Regexp) CompileGraphite(expr string) error

CompileGraphite parses a regular expression to Graphite See : http://graphite.readthedocs.io/en/latest/render_api.html

func (*Regexp) ExpandNode

func (re *Regexp) ExpandNode(node Node) (string, bool)

ExpandNode replaces expression to node returns the result;.

func (*Regexp) MatchNode

func (re *Regexp) MatchNode(node Node) bool

MatchNode reports whether the Regexp matches the node.

type SharedFinder

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

SharedFinder represents a simple finder.

func (SharedFinder) GetAllNodes

func (finder SharedFinder) GetAllNodes() ([]Node, error)

GetAllNodes returns all found nodes.

func (SharedFinder) GetNeighborhoodNode

func (finder SharedFinder) GetNeighborhoodNode(node Node) (Node, error)

GetNeighborhoodNode returns a neighborhood node of the specified node.

func (SharedFinder) GetPrefixNodes

func (finder SharedFinder) GetPrefixNodes(targetString string) ([]Node, error)

GetPrefixNodes returns only nodes matching with a specified start string.

func (SharedFinder) GetRegexpNodes

func (finder SharedFinder) GetRegexpNodes(re *regexp.Regexp) ([]Node, error)

GetRegexpNodes returns only nodes matching with a specified regular expression.

func (SharedFinder) HasNode

func (finder SharedFinder) HasNode(targetNode Node) bool

HasNode returns true when the specified node is added already, otherwise false.

func (*SharedFinder) IsRunning

func (finder *SharedFinder) IsRunning() bool

IsRunning returns true when the finder is running, otherwise false.

func (*SharedFinder) Search

func (finder *SharedFinder) Search() error

SearchAll searches all nodes.

func (SharedFinder) SetNotifyListener

func (finder SharedFinder) SetNotifyListener(l FinderNotifyListener) error

SetSearchListener sets the search listener.

func (SharedFinder) SetSearchListener

func (finder SharedFinder) SetSearchListener(l FinderSearchListener) error

SetSearchListener sets the search listener.

func (*SharedFinder) Start

func (finder *SharedFinder) Start() error

Start starts the finder.

func (*SharedFinder) Stop

func (finder *SharedFinder) Stop() error

Stop stops the finder.

func (*SharedFinder) String

func (finder *SharedFinder) String() string

String returns the description.

type StaticFinder

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

StaticFinder represents a simple static finder.

func (StaticFinder) GetAllNodes

func (finder StaticFinder) GetAllNodes() ([]Node, error)

GetAllNodes returns all found nodes.

func (StaticFinder) GetNeighborhoodNode

func (finder StaticFinder) GetNeighborhoodNode(node Node) (Node, error)

GetNeighborhoodNode returns a neighborhood node of the specified node.

func (StaticFinder) GetPrefixNodes

func (finder StaticFinder) GetPrefixNodes(targetString string) ([]Node, error)

GetPrefixNodes returns only nodes matching with a specified start string.

func (StaticFinder) GetRegexpNodes

func (finder StaticFinder) GetRegexpNodes(re *regexp.Regexp) ([]Node, error)

GetRegexpNodes returns only nodes matching with a specified regular expression.

func (StaticFinder) HasNode

func (finder StaticFinder) HasNode(targetNode Node) bool

HasNode returns true when the specified node is added already, otherwise false.

func (*StaticFinder) IsRunning

func (finder *StaticFinder) IsRunning() bool

IsRunning returns true when the finder is running, otherwise false.

func (*StaticFinder) Search

func (finder *StaticFinder) Search() error

SearchAll searches all nodes.

func (StaticFinder) SetNotifyListener

func (finder StaticFinder) SetNotifyListener(l FinderNotifyListener) error

SetSearchListener sets the search listener.

func (StaticFinder) SetSearchListener

func (finder StaticFinder) SetSearchListener(l FinderSearchListener) error

SetSearchListener sets the search listener.

func (*StaticFinder) Start

func (finder *StaticFinder) Start() error

Start starts the finder.

func (*StaticFinder) Stop

func (finder *StaticFinder) Stop() error

Stop stops the finder.

func (*StaticFinder) String

func (finder *StaticFinder) String() string

String returns the description.

type StaticTOMLFinder

type StaticTOMLFinder struct {
	*StaticFinder
}

StaticFinder represents a simple static finder.

func (StaticTOMLFinder) GetAllNodes

func (finder StaticTOMLFinder) GetAllNodes() ([]Node, error)

GetAllNodes returns all found nodes.

func (StaticTOMLFinder) GetNeighborhoodNode

func (finder StaticTOMLFinder) GetNeighborhoodNode(node Node) (Node, error)

GetNeighborhoodNode returns a neighborhood node of the specified node.

func (StaticTOMLFinder) GetPrefixNodes

func (finder StaticTOMLFinder) GetPrefixNodes(targetString string) ([]Node, error)

GetPrefixNodes returns only nodes matching with a specified start string.

func (StaticTOMLFinder) GetRegexpNodes

func (finder StaticTOMLFinder) GetRegexpNodes(re *regexp.Regexp) ([]Node, error)

GetRegexpNodes returns only nodes matching with a specified regular expression.

func (StaticTOMLFinder) HasNode

func (finder StaticTOMLFinder) HasNode(targetNode Node) bool

HasNode returns true when the specified node is added already, otherwise false.

func (StaticTOMLFinder) SetNotifyListener

func (finder StaticTOMLFinder) SetNotifyListener(l FinderNotifyListener) error

SetSearchListener sets the search listener.

func (StaticTOMLFinder) SetSearchListener

func (finder StaticTOMLFinder) SetSearchListener(l FinderSearchListener) error

SetSearchListener sets the search listener.

func (*StaticTOMLFinder) String

func (finder *StaticTOMLFinder) String() string

String returns the description.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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