output

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action interface {
	// Add adds new resource metadata.
	Add(syncData *action.SyncData)

	// Delete deletes target resource metadata.
	Delete(syncData *action.SyncData)

	// Update updates target resource metadata.
	Update(syncData *action.SyncData)
}

Action handles the metadata in ADD/DEL/UPDATE methods.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is resource handler, consumes metadata distributed from Writer, and handles data with the action.

func NewHandler

func NewHandler(dataType string, act Action) *Handler

NewHandler creates a new resource Handler instance with the action.

func (*Handler) Handle

func (h *Handler) Handle(data *action.SyncData)

Handle sends the metadata into handler queue.

func (*Handler) HandleWithTimeout

func (h *Handler) HandleWithTimeout(data *action.SyncData, timeout time.Duration)

HandleWithTimeout sends the metadata into handler queue with timeout.

func (*Handler) Run

func (h *Handler) Run(stopCh <-chan struct{})

Run starts the handler.

type Writer

type Writer struct {

	// settled handlers.
	Handlers map[string]*Handler
	// contains filtered or unexported fields
}

Writer writes the metadata to target storage service. There are queues for normal data and alarm message data, every metadata in queues would be distributed to settled handler.

func NewWriter

func NewWriter(clusterID string, storageService *bcs.InnerService, alertor *action.Alertor) (*Writer, error)

NewWriter creates a new Writer instance which base on bcs-storage service and alarm sender.

func (*Writer) Run

func (w *Writer) Run(stopCh <-chan struct{}) error

Run runs the Writer instance with target stop channel, and starts all handlers. There is a groutine which keep consuming metadata in queues and distributes data to settled handler until stop channel is activated.

func (*Writer) Sync

func (w *Writer) Sync(data *action.SyncData)

Sync syncs normal metadata by sending into queue.

func (*Writer) SyncAlarmEvent

func (w *Writer) SyncAlarmEvent(data *action.SyncData)

SyncAlarmEvent syncs alarm message data by sending into alarm queue.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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