model

package
v2.0.7-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bindings

type Bindings map[string]string

type Event

type Event struct {
	K            string       `json:"key" redis:"key"`
	Type         Type         `json:"type" redis:"type"`
	ResourceType ResourceType `json:"resource_type" redis:"resource_type"`
	ResourceName string       `json:"resource_name" redis:"resource_name"`
	FirstTime    time.Time    `json:"first_time" redis:"first_time"`
	LastTime     time.Time    `json:"last_time" redis:"last_time"`
	Count        int          `json:"count" redis:"count"`
	MessageType  MessageType  `json:"type_message" redis:"type_message"`
	Message      string       `json:"message" redis:"message"`
	NodeName     string       `json:"node_name" redis:"node_name"`
	NodeIP       net.IP       `json:"node_ip" redis:"node_ip"`
}

Event generated by pipelines and nodes in the cluster. Events include common information and error information, which can be easily located when an error occurs

func NewErrorCluster

func NewErrorCluster(msg string) (e *Event)

NewErrorCluster returns a new cluster error event

func NewErrorNode

func NewErrorNode(msg string) (e *Event)

NewErrorNode returns a new node error event

func NewErrorPipeline

func NewErrorPipeline(name string, msg string) (e *Event)

NewErrorPipeline returns a new pipeline error event

func NewInfoCluster

func NewInfoCluster(msg string) (e *Event)

NewInfoCluster returns a new cluster info event

func NewInfoNode

func NewInfoNode(msg string) (e *Event)

NewInfoNode returns a new node event of info level

func NewInfoPipeline

func NewInfoPipeline(name string, msg string) (e *Event)

NewInfoPipeline returns a new pipeline info event

func NewWarnCluster

func NewWarnCluster(msg string) (e *Event)

NewWarnCluster returns a new cluster warn event

func NewWarnNode

func NewWarnNode(msg string) (e *Event)

NewWarnNode returns a new node warn event

func NewWarnPipeline

func NewWarnPipeline(name string, msg string) (e *Event)

NewWarnPipeline returns a new pipeline warn event

func (*Event) Key

func (e *Event) Key() string

func (*Event) Unmarshal

func (e *Event) Unmarshal(data []byte) error

func (*Event) Val

func (e *Event) Val() string

type MessageType

type MessageType = string

MessageType todo

const (
	// MSG_EMPTY default type
	MSG_EMPTY MessageType = ""
)

type Model

type Model interface {
	Val() string
	Key() string
	Unmarshal([]byte) error
}

Model base model

type PipelineBind

type PipelineBind struct {
	Bindings Bindings `json:"bindings" redis:"bindings"`
}

PipelineBind pipeline bind the node will watch pipeline bind, run pipeline instance if node get the bind, stop instance if node lost bind

func (*PipelineBind) Key

func (s *PipelineBind) Key() (key string)

Key generate etcd prefix of pipeline bind

func (*PipelineBind) Unmarshal

func (s *PipelineBind) Unmarshal(val []byte) (err error)

Unmarshal generate pipeline bind from json data

func (*PipelineBind) Val

func (s *PipelineBind) Val() (val string)

Val marshal pipeline bind to json data

type RegisterNode

type RegisterNode struct {
	Name string `json:"name" redis:"name"`
}

func (*RegisterNode) Key

func (s *RegisterNode) Key() string

func (*RegisterNode) Unmarshal

func (s *RegisterNode) Unmarshal(data []byte) error

func (*RegisterNode) Val

func (s *RegisterNode) Val() string

type ResourceType

type ResourceType = string

ResourceType pipeline or node or etc.

const (
	// PIPELINE resource type
	PIPELINE ResourceType = "pipeline"
	// ResourceType resource type
	NODE ResourceType = "node"
	// CLUSTER resource type
	CLUSTER ResourceType = "cluster"
)

type Type

type Type = string

Type event level

const (
	// WARN level
	WARN Type = "warn"
	// ERROR level
	ERROR Type = "error"
	// INFO level
	INFO Type = "info"
)

type Values

type Values map[string]any

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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