utils

package
v0.0.0-...-46d7ffa Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureCli

func ConfigureCli(conf *Configuration) error

func CreateAckFrame

func CreateAckFrame(nodeId string) *tcp.Frame

func GetConfigurationForCluster

func GetConfigurationForCluster() utils.Configuration

func OverwritePort

func OverwritePort(port string)

warning: if calling SetConfFile after OverwritePort, the conf file wont be loaded

func SetConfFile

func SetConfFile(confFilePath string)

Types

type Cluster

type Cluster struct {
	NodeId      string
	CommManager *communication.CommunicationManager
	// contains filtered or unexported fields
}

func InitCluster

func InitCluster(nodeId string, nodeIp string, nodePort string) *Cluster

func (*Cluster) HandleEvent

func (c *Cluster) HandleEvent(msg *tcp.MessageFromCluster)

func (*Cluster) Shutdown

func (c *Cluster) Shutdown()

func (*Cluster) StartListening

func (c *Cluster) StartListening()

type ClusterConfiguration

type ClusterConfiguration struct {
	LOG_LEVEL                string
	LOG_TO                   string
	LOG_DIR                  string
	LOG_FILE_NAME            string
	LOG_FILE_MAX_SIZE        int
	LOG_FILE_MAX_NUM_BACKUPS int
	LOG_FILE_MAX_AGE         int
	LOG_GOSSIP_PROTOCOL      bool
	LOG_STORAGE              bool
	NODE_IP                  string
	NODE_PORT                string
	NODE_HEARTBIT_PORT       string

	CLUSTER_NODE_IP            string
	CLUSTER_NODE_PORT          string
	CLUSTER_NODE_HEARTBIT_PORT string

	NUMB_VNODES int

	DATA_FOLDER string
}

func GetClusterConfiguration

func GetClusterConfiguration() *ClusterConfiguration

type Configuration

type Configuration struct {
	CLI_IP            string `yaml:"ip"`
	CLI_PORT          string `yaml:"port"`
	CLUSTER_NODE_IP   string `yaml:"clusterNodeIp"`
	CLUSTER_NODE_PORT string `yaml:"clusterNodePort"`
}

func LoadConfiguration

func LoadConfiguration(confFilePath string) (Configuration, error)

type Logger

type Logger struct {
	*zerolog.Logger
}

func Configure

func Configure(conf *ClusterConfiguration) *Logger

func GetLogger

func GetLogger() *Logger

func (*Logger) Debug

func (c *Logger) Debug(msg string)

func (*Logger) Error

func (c *Logger) Error(err error, msg string)

func (*Logger) Fatal

func (c *Logger) Fatal(err error, msg string)

func (*Logger) Info

func (c *Logger) Info(msg string)

func (*Logger) Panic

func (c *Logger) Panic(err error, msg string)

func (*Logger) Trace

func (c *Logger) Trace(msg string)

func (*Logger) Warn

func (c *Logger) Warn(msg string)

Jump to

Keyboard shortcuts

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