runtime

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WrkrOptName = iota
	WrkrOptJobQueue
	WrkrOptStartFunc
	WrkrOptExtFunc
	WrkrOptNxNetworkClient
)
View Source
const (
	APIVersionV1 = "v1"
	Kind         = "Job"

	JobTypeCommand = "cmdJob"
	JobTypeNetwork = "networkJob"
	JobTypeIPAM    = "ipamJob"
)
View Source
const (
	JobPriorityLow    = "LOW"
	JobPriorityMedium = "MEDIUM"
	JobPriorityHigh   = "HIGH"
)

Variables

View Source
var ErrorEventsJobQueue = make(chan error, 128)

Functions

func ErrorEventsHandler

func ErrorEventsHandler(w *Wrkr)

func NetworkWrkrReconnect

func NetworkWrkrReconnect(newNxNC rpc.NxNetworkClient)

func RegisterWrkr

func RegisterWrkr(wID int, wOpts ...*WrkrOpt)

func StartWrkrs

func StartWrkrs()

func StopWrkrs

func StopWrkrs(wg *sync.WaitGroup)

Types

type Job

type Job struct {
	APIVersion string  `json:"apiVersion"`
	Kind       string  `json:"kind"`
	Spec       JobSpec `json:"spec"`
}

func NewJob

func NewJob(id, nodeID, jobType, priority string) *Job

type JobSpec

type JobSpec struct {
	ID        string      `json:"eventId"`
	NodeID    string      `json:"nodeId"`
	JobType   string      `json:"jobType"`
	Priority  string      `json:"priority"`
	Timestamp time.Time   `json:"timestamp"`
	Payload   interface{} `json:"payload"`
}

type Jobs

type Jobs []Job

type Wrkr

type Wrkr struct {
	Name     string
	JobQueue interface{}
	QuitChan chan struct{}
	Running  bool
	WG       *sync.WaitGroup
	Ctx      context.Context

	NxNC rpc.NxNetworkClient
	// contains filtered or unexported fields
}

type WrkrOpt

type WrkrOpt struct {
	Key   int
	Value interface{}
}

func SetWrkrOpt

func SetWrkrOpt(k int, v interface{}) *WrkrOpt

Jump to

Keyboard shortcuts

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