message

package
v0.0.0-...-bd8fb77 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	A6RoutesConf    = 0
	A6UpstreamsConf = 1
	A6ServicesConf  = 2
)

Variables

This section is empty.

Functions

func ServiceFilter

func ServiceFilter(msg *Message) bool

func ServiceReplace

func ServiceReplace(msg, newMsg *Message) bool

func ServiceUpdate

func ServiceUpdate(msg, newMsg *Message) bool

func ToA6Type

func ToA6Type(prefix string) int

Types

type A6Conf

type A6Conf interface {
	GetAll() *map[string]interface{}
	Inject(nodes interface{})
	Marshal() ([]byte, error)
	GetUpstream() Upstream
	HasNodesAttr() bool
}

func NewA6Conf

func NewA6Conf(value []byte, a6Type int) (A6Conf, error)

func NewRoutes

func NewRoutes(value []byte) (A6Conf, error)

func NewServices

func NewServices(value []byte) (A6Conf, error)

func NewUpstreams

func NewUpstreams(value []byte) (A6Conf, error)

type Message

type Message struct {
	Key     string
	Value   string
	Version int64
	Action  StoreEvent
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(key string, value []byte, version int64, action StoreEvent, a6Type int) (*Message, error)

func (*Message) DiscoveryArgs

func (msg *Message) DiscoveryArgs() map[string]interface{}

func (*Message) DiscoveryType

func (msg *Message) DiscoveryType() string

func (*Message) HasNodesAttr

func (msg *Message) HasNodesAttr() bool

func (*Message) InjectNodes

func (msg *Message) InjectNodes(nodes interface{})

func (*Message) Marshal

func (msg *Message) Marshal() ([]byte, error)

func (*Message) ServiceName

func (msg *Message) ServiceName() string

type Node

type Node struct {
	Host     string      `json:"host,omitempty"`
	Port     int         `json:"port,omitempty"`
	Weight   int         `json:"weight"`
	Metadata interface{} `json:"metadata,omitempty"`
}

type Routes

type Routes struct {
	Upstream Upstream               `json:"upstream"`
	All      map[string]interface{} `json:"-"`
	// contains filtered or unexported fields
}

func (*Routes) GetAll

func (routes *Routes) GetAll() *map[string]interface{}

func (*Routes) GetUpstream

func (routes *Routes) GetUpstream() Upstream

func (*Routes) HasNodesAttr

func (routes *Routes) HasNodesAttr() bool

func (*Routes) Inject

func (routes *Routes) Inject(nodes interface{})

func (*Routes) Marshal

func (routes *Routes) Marshal() ([]byte, error)

type Services

type Services struct {
	Upstream Upstream               `json:"upstream"`
	All      map[string]interface{} `json:"-"`
	// contains filtered or unexported fields
}

func (*Services) GetAll

func (services *Services) GetAll() *map[string]interface{}

func (*Services) GetUpstream

func (services *Services) GetUpstream() Upstream

func (*Services) HasNodesAttr

func (services *Services) HasNodesAttr() bool

func (*Services) Inject

func (services *Services) Inject(nodes interface{})

func (*Services) Marshal

func (services *Services) Marshal() ([]byte, error)

type StoreEvent

type StoreEvent = int
const (
	// add or update config
	EventAdd StoreEvent = 0x01
	// delete config
	EventDelete StoreEvent = 0102
)

type Upstream

type Upstream struct {
	Nodes            interface{}  `json:"nodes,omitempty"`
	DiscoveryType    string       `json:"discovery_type,omitempty"`
	DupDiscoveryType string       `json:"_discovery_type,omitempty"`
	DiscoveryArgs    *UpstreamArg `json:"discovery_args,omitempty"`
	DupServiceName   string       `json:"_service_name,omitempty"`
	ServiceName      string       `json:"service_name,omitempty"`
}

type UpstreamArg

type UpstreamArg struct {
	NamespaceID string                 `json:"namespace_id,omitempty"`
	GroupName   string                 `json:"group_name,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

type Upstreams

type Upstreams struct {
	Upstream

	All map[string]interface{} `json:"-"`
	// contains filtered or unexported fields
}

func (*Upstreams) GetAll

func (ups *Upstreams) GetAll() *map[string]interface{}

func (*Upstreams) GetUpstream

func (ups *Upstreams) GetUpstream() Upstream

func (*Upstreams) HasNodesAttr

func (ups *Upstreams) HasNodesAttr() bool

func (*Upstreams) Inject

func (ups *Upstreams) Inject(nodes interface{})

func (*Upstreams) Marshal

func (ups *Upstreams) Marshal() ([]byte, error)

Jump to

Keyboard shortcuts

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