common

package
v1.17.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	VolumePattern = `^\w[-\w.+]*/` + constants.CSIResourceTypeVolume + `/\w[-\w.+]*`
)

VolumePattern constants for error message

Variables

VolumeRegExp is used to validate the volume resource

Functions

func AckMessageKeyFunc

func AckMessageKeyFunc(obj interface{}) (string, error)

func ConstructConnectMessage

func ConstructConnectMessage(info *model.HubInfo, isConnected bool) *beehivemodel.Message

func DeepCopy

func DeepCopy(msg *beehivemodel.Message) *beehivemodel.Message

func GetMessageDeletionTimestamp

func GetMessageDeletionTimestamp(msg *beehivemodel.Message) (*v1.Time, error)

GetMessageDeletionTimestamp returns the deletionTimestamp of the object in message

func GetMessageUID

func GetMessageUID(msg beehivemodel.Message) (string, error)

GetMessageUID returns the UID of the object in message

func IsVolumeResource

func IsVolumeResource(resource string) bool

func NoAckMessageKeyFunc

func NoAckMessageKeyFunc(obj interface{}) (string, error)

func NotifyEventQueueError

func NotifyEventQueueError(conn conn.Connection, nodeID string)

func TrimMessage

func TrimMessage(msg *beehivemodel.Message)

TrimMessage trims resource field in message before: node/{nodename}/{namespace}/pod/{podname} after: {namespace}/pod/{podname}

Types

type NodeMessagePool

type NodeMessagePool struct {
	// AckMessageStore store message that will send to edge node
	// and require acknowledgement from edge node.
	AckMessageStore cache.Store
	// AckMessageQueue store message key that will send to edge node
	// and require acknowledgement from edge node.
	AckMessageQueue workqueue.RateLimitingInterface
	// NoAckMessageStore store message that will send to edge node
	// and do not require acknowledgement from edge node.
	NoAckMessageStore cache.Store
	// NoAckMessageQueue store message key that will send to edge node
	// and do not require acknowledgement from edge node.
	NoAckMessageQueue workqueue.RateLimitingInterface
}

NodeMessagePool is a collection of all downstream messages sent to an edge node. There are two types of messages, one that requires an ack and one that does not. For each type of message, we use the `queue` to mark the order of sending, and use the `store` to store specific messages

func InitNodeMessagePool

func InitNodeMessagePool(nodeID string) *NodeMessagePool

InitNodeMessagePool init node message pool for node

func (*NodeMessagePool) GetAckMessage

func (nsp *NodeMessagePool) GetAckMessage(key string) (*beehivemodel.Message, error)

GetAckMessage get message that requires ack with the key

func (*NodeMessagePool) GetNoAckMessage

func (nsp *NodeMessagePool) GetNoAckMessage(key string) (*beehivemodel.Message, error)

GetNoAckMessage get message that does not require ack with the key

func (*NodeMessagePool) ShutDown

func (nsp *NodeMessagePool) ShutDown()

ShutDown will close all the message queue in the message pool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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