libOrch

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultName = "default"
View Source
const GlobalName = "global"

Variables

This section is empty.

Functions

func DispatchMessage

func DispatchMessage(gs BaseGlobalState, message string, messageType string)

func DispatchMessageNoSet

func DispatchMessageNoSet(gs BaseGlobalState, message string, messageType string)

func DispatchWorkerMessage

func DispatchWorkerMessage(gs BaseGlobalState, workerId string, childJobId string, message string, messageType string)

func HandleError

func HandleError(gs BaseGlobalState, err error)

func HandleErrorNoSet

func HandleErrorNoSet(gs BaseGlobalState, err error)

func HandleStringError

func HandleStringError(gs BaseGlobalState, errString string)

func SetInBucket

func SetInBucket(bucket *gridfs.Bucket, filename string, data []byte, contentType string, storeReceipt *primitive.ObjectID) error

func UpdateStatus

func UpdateStatus(gs BaseGlobalState, status string)

func UpdateStatusNoSet

func UpdateStatusNoSet(gs BaseGlobalState, status string)

Types

type APITeamOptions

type APITeamOptions struct {
	Distribution `json:"distribution"`
}

type BaseGlobalState

type BaseGlobalState interface {
	Ctx() context.Context
	Logger() *logrus.Logger
	OrchestratorClient() *redis.Client
	JobId() string
	OrchestratorId() string
	MetricsStore() *BaseMetricsStore
	GetStatus() string
	SetStatus(string)

	CreditsManager() *lib.CreditsManager
	Standalone() bool
	FuncAuthClient() RunAuthClient
	LoadZones() []string
	MessageQueue() *MessageQueue
}

type BaseMetricsStore

type BaseMetricsStore interface {
	InitMetricsStore(childJobs map[string]ChildJobDistribution)
	AddMessage(message WorkerMessage, workerLocation string, subFraction float64) error
	Cleanup()
}

Cached metrics are stored before being collated and sent

type ChildJob

type ChildJob struct {
	Job
	ChildJobId        string                 `json:"childJobId"`
	Options           libWorker.Options      `json:"options"`
	UnderlyingRequest map[string]interface{} `json:"underlyingRequest"`
	FinalRequest      map[string]interface{} `json:"finalRequest"`
	SubFraction       float64                `json:"subFraction"`
	WorkerConnection  *websocket.Conn
	ConnWriteMutex    *sync.Mutex
	ConnReadMutex     *sync.Mutex
}

type ChildJobDistribution added in v0.1.4

type ChildJobDistribution struct {
	ChildJobs []*ChildJob `json:"jobs"`
}

type CollectionContext

type CollectionContext struct {
	Variables []libWorker.KeyValueItem `json:"variables"`
	Name      string                   `json:"name"`
}

type Distribution

type Distribution struct {
	LoadZone string `json:"loadZone"`
	Percent  int    `json:"percent"`
}

type EnvironmentContext

type EnvironmentContext struct {
	Variables []libWorker.KeyValueItem `json:"variables"`
	Name      string                   `json:"name"`
}

type Job

type Job struct {
	Id                     string                 `json:"id"`
	Source                 string                 `json:"source"`
	SourceName             string                 `json:"sourceName"`
	EnvironmentContext     *EnvironmentContext    `json:"environmentContext"`
	CollectionContext      *CollectionContext     `json:"collectionContext"`
	UnderlyingRequest      map[string]interface{} `json:"underlyingRequest"`
	FinalRequest           map[string]interface{} `json:"finalRequest"`
	AssignedOrchestrator   string                 `json:"assignedOrchestrator"`
	Scope                  Scope                  `json:"scope"`
	Options                *libWorker.Options     `json:"options"`
	VerifiedDomains        []string               `json:"verifiedDomains"`
	FuncModeInfo           *lib.FuncModeInfo      `json:"funcModeInfo"`
	PermittedLoadZones     []string               `json:"permittedLoadZones"`
	MaxTestDurationMinutes int64                  `json:"maxTestDurationMinutes"`
	MaxSimulatedUsers      int64                  `json:"maxSimulatedUsers"`
}

type LiveService added in v0.2.0

type LiveService struct {
	Location string
	Uri      string

	State runpb.Condition_State
}

type LocalhostFile

type LocalhostFile struct {
	FileName string `json:"fileName"`
	Contents string `json:"contents"`
	Kind     string `json:"kind"`
}

type MarkMessage

type MarkMessage struct {
	Mark    string      `json:"mark"`
	Message interface{} `json:"message"`
}

type MessageQueue added in v0.2.0

type MessageQueue struct {
	Mutex sync.Mutex

	// The count of currently actively being sent messages
	QueueCount    int
	NewQueueCount chan int
}

type NamedConnection added in v0.2.0

type NamedConnection struct {
	Name       string
	Connection *websocket.Conn
}

type OrchestratorMessage

type OrchestratorMessage struct {
	JobId          string    `json:"jobId"`
	Time           time.Time `json:"time"`
	OrchestratorId string    `json:"orchestratorId"`
	Message        string    `json:"message"`
	MessageType    string    `json:"messageType"`
}

type OrchestratorOrWorkerMessage

type OrchestratorOrWorkerMessage struct {
	JobId          string    `json:"jobId"`
	Time           time.Time `json:"time"`
	ChildJobId     string    `json:"childJobId"`
	OrchestratorId string    `json:"orchestratorId"`
	WorkerId       string    `json:"workerId"`
	Message        string    `json:"message"`
	MessageType    string    `json:"messageType"`
}

type RunAuthClient added in v0.2.0

type RunAuthClient interface {
	Services() []LiveService
	ExecuteService(gs BaseGlobalState, location string) (*websocket.Conn, error)
	CheckServiceAvailability(location string) error
}

type Scope

type Scope struct {
	Variant         string `json:"variant"`
	VariantTargetId string `json:"variantTargetId"`
}

type WorkerConnections added in v0.2.0

type WorkerConnections struct {
	Connections       map[string]*NamedConnection
	DefaultConnection *NamedConnection
}

type WorkerMessage

type WorkerMessage struct {
	JobId       string    `json:"jobId"`
	ChildJobId  string    `json:"childJobId"`
	Time        time.Time `json:"time"`
	WorkerId    string    `json:"workerId"`
	Message     string    `json:"message"`
	MessageType string    `json:"messageType"`
}

type WorkerState

type WorkerState struct {
	Status     string `json:"status"`
	WorkerId   string `json:"workerId"`
	ChildJobId string `json:"childJobId"`
}

Jump to

Keyboard shortcuts

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