node

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToNode

func ConnectToNode(x *Node) (*hconn.HConn, error)

func ConnectToNodeWithHostAndPort

func ConnectToNodeWithHostAndPort(ip string, port string) (*hconn.HConn, error)

Types

type Entity

type Entity struct {
	Name string
}

type EntityStorage

type EntityStorage struct {
	Disk   *disk.Disk
	Memory *register.Entity
}

func (*EntityStorage) HandleQuery

func (x *EntityStorage) HandleQuery(q *query.Query) ([]register.Model, error)

type Host

type Host struct {
	Name string
	Port int
}

type Node

type Node struct {
	// Props coming from json config
	Host     Host
	Path     Path
	Entities []Entity

	ErrCh           chan error
	Status          Status
	HConn           *hconn.HConn
	Peers           []*Node
	EntitiesStorage []*EntityStorage
	PeerConnected   bool

	Mu sync.Mutex
}

func NewNode

func NewNode() *Node

func (*Node) AddEntity

func (x *Node) AddEntity(name string) *Node

func (*Node) AddPeer

func (x *Node) AddPeer(p *Node) *Node

func (*Node) Start

func (x *Node) Start() error

func (*Node) WaitStatusActive

func (x *Node) WaitStatusActive()

func (*Node) WithHost

func (x *Node) WithHost(name string, port int) *Node

func (*Node) WithPath

func (x *Node) WithPath(pathData string) *Node

type Path

type Path struct {
	Data string
}

type ResultType added in v0.0.3

type ResultType int
const (
	ResultTypeAll ResultType = iota
	ResultTypeIntersect
	ResultTypeUnion
)

type Status

type Status int
const (
	StatusStarting Status = iota
	StatusActive
	StatusReady
)

Jump to

Keyboard shortcuts

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