statusutil

package
v0.0.0-...-64decf6 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WorkerStatusTopic

func WorkerStatusTopic(masterID frameModel.MasterID) string

WorkerStatusTopic returns the p2p topic for worker status subscription of a given master.

Types

type WorkerStatusMessage

type WorkerStatusMessage struct {
	Worker      frameModel.WorkerID      `json:"worker"`
	MasterEpoch frameModel.Epoch         `json:"master-epoch"`
	Status      *frameModel.WorkerStatus `json:"status"`
}

WorkerStatusMessage contains necessary fileds of a worker status message

type Writer

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

Writer is used to persist WorkerStatus changes and send notifications to the Master.

func NewWriter

func NewWriter(
	metaclient pkgOrm.Client,
	messageSender p2p.MessageSender,
	masterInfo worker.MasterInfoProvider,
	workerID frameModel.WorkerID,
) *Writer

NewWriter creates a new Writer.

func (*Writer) UpdateStatus

func (w *Writer) UpdateStatus(ctx context.Context, newStatus *frameModel.WorkerStatus) (retErr error)

UpdateStatus checks if newStatus.HasSignificantChange() is true, if so, it persists the change and tries to send a notification. Note that sending the notification is asynchronous.

Jump to

Keyboard shortcuts

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