server

package
v0.0.0-...-43a96cf Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 28 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultRecurrence         = "FREQ=SECONDLY;DTSTART=20200612T182105Z;INTERVAL=60"
	DefaultJobIntervalSeconds = 60
)

Variables

View Source
var (
	DisconnectedServicesWorkflowName = cereal.NewWorkflowName("disconnected_services")
	DisconnectedServicesScheduleName = "periodic_disconnected_services"

	DeleteDisconnectedServicesWorkflowName = cereal.NewWorkflowName("delete_disconnected_services")
	DeleteDisconnectedServicesScheduleName = "periodic_delete_disconnected_services"
)

Functions

func ConnectToJobsManager

func ConnectToJobsManager(jobCfg *config.Jobs, connFactory *secureconn.Factory) (*cereal.Manager, error)

func DaysBetween

func DaysBetween(fromTime, toTime time.Time) int

DaysBetween get the calendar days between two timestamp

Types

type ApplicationsServer

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

ApplicationsServer is the interface to this component.

func New

New creates a new ApplicationsServer instance.

func (*ApplicationsServer) DeleteDisconnectedServices

func (app *ApplicationsServer) DeleteDisconnectedServices(ctx context.Context,
	request *applications.DisconnectedServicesReq) (*applications.ServicesRes, error)

DeleteDisconnectedServices deletes disconnected services and returns the list of services deleted

func (*ApplicationsServer) DeleteServicesByID

func (*ApplicationsServer) FindServices

func (*ApplicationsServer) GetDisconnectedServices

func (app *ApplicationsServer) GetDisconnectedServices(ctx context.Context,
	request *applications.DisconnectedServicesReq) (*applications.ServicesRes, error)

GetDisconnectedServices returns a list of disconnected services

func (*ApplicationsServer) GetServiceGroups

func (*ApplicationsServer) GetServiceGroupsHealthCounts

func (app *ApplicationsServer) GetServiceGroupsHealthCounts(
	ctx context.Context, request *applications.ServiceGroupsHealthCountsReq,
) (*applications.HealthCounts, error)

GetServiceGroupsHealthCounts returns the health counts from all service groups

func (*ApplicationsServer) GetServices

GetServices returns a list of services

func (*ApplicationsServer) GetServicesBySG

GetServicesBySG returns a list of services within a service-group

func (*ApplicationsServer) GetServicesDistinctValues

func (*ApplicationsServer) GetServicesStats

func (*ApplicationsServer) GetServicesUsageCount

GetServicesUsageCount returns the count of unique nodes with lastRun in a given time.

func (*ApplicationsServer) GetVersion

GetVersion returns the version of service

func (*ApplicationsServer) Health

func (a *ApplicationsServer) Health() *health.Service

Health returns the servers embedded health check service

func (*ApplicationsServer) MarkDisconnectedServices

func (app *ApplicationsServer) MarkDisconnectedServices(thresholdSeconds int32) ([]*applications.Service, error)

type DeleteDisconnectedServicesExecutor

type DeleteDisconnectedServicesExecutor struct {
	ApplicationsServer *ApplicationsServer
	// contains filtered or unexported fields
}

func (*DeleteDisconnectedServicesExecutor) Run

func (d *DeleteDisconnectedServicesExecutor) Run(ctx context.Context, t cereal.Task) (interface{}, error)

func (*DeleteDisconnectedServicesExecutor) TotalRuns

type DisconnectedServicesConfigAndInfo

type DisconnectedServicesConfigAndInfo struct {
	*DisconnectedServicesConfigV0
	*DisconnectedServicesInfo
}

type DisconnectedServicesConfigV0

type DisconnectedServicesConfigV0 struct {
	Enabled    bool
	Params     *DisconnectedServicesParamsV0
	Recurrence string // string representation of rrule
	// contains filtered or unexported fields
}

+ enabled/disabled for both jobs, not just the deleter + recurrence for both

func (*DisconnectedServicesConfigV0) Validate

func (c *DisconnectedServicesConfigV0) Validate() (bool, string)

func (*DisconnectedServicesConfigV0) Verror

func (c *DisconnectedServicesConfigV0) Verror() error

type DisconnectedServicesInfo

type DisconnectedServicesInfo struct {
	LastEnqueuedAt *time.Time
	LastStartedAt  *time.Time
	LastEndedAt    *time.Time
	LastElapsed    *time.Duration
	NextDueAt      *time.Time
}

type DisconnectedServicesParamsV0

type DisconnectedServicesParamsV0 struct {
	ThresholdDuration string `mapstructure:"threshold_duration"`
}

type JobRunnerSet

type JobRunnerSet struct {
	MarkDisconnectedServicesExecutor   *MarkDisconnectedServicesExecutor
	DeleteDisconnectedServicesExecutor *DeleteDisconnectedServicesExecutor
}

func NewJobRunnerSet

func NewJobRunnerSet(applicationsServer *ApplicationsServer) *JobRunnerSet

func (*JobRunnerSet) Start

func (j *JobRunnerSet) Start(cerealSvc *cereal.Manager) error

type JobScheduler

type JobScheduler struct {
	CerealSvc *cereal.Manager
}

func NewJobScheduler

func NewJobScheduler(cerealSvc *cereal.Manager) *JobScheduler

func (*JobScheduler) DisableDeleteDisconnectedServicesJob

func (j *JobScheduler) DisableDeleteDisconnectedServicesJob(ctx context.Context) error

func (*JobScheduler) DisableDisconnectedServicesJob

func (j *JobScheduler) DisableDisconnectedServicesJob(ctx context.Context) error

func (*JobScheduler) EnableDeleteDisconnectedServicesJob

func (j *JobScheduler) EnableDeleteDisconnectedServicesJob(ctx context.Context) error

func (*JobScheduler) EnableDisconnectedServicesJob

func (j *JobScheduler) EnableDisconnectedServicesJob(ctx context.Context) error

func (*JobScheduler) GetDeleteDisconnectedServicesJobConfig

func (j *JobScheduler) GetDeleteDisconnectedServicesJobConfig(ctx context.Context) (*DisconnectedServicesConfigAndInfo, error)

func (*JobScheduler) GetDisconnectedServicesJobConfig

func (j *JobScheduler) GetDisconnectedServicesJobConfig(ctx context.Context) (*DisconnectedServicesConfigAndInfo, error)

func (*JobScheduler) ResetParams

func (j *JobScheduler) ResetParams() error

FIXME: should this be changed to do a full reset?

func (*JobScheduler) RunAllJobsConstantly

func (j *JobScheduler) RunAllJobsConstantly(ctx context.Context) error

RunAllJobsConstantly sets all the jobs to run every 1 second. Intended for use in testing scenarios.

func (*JobScheduler) RunDeleteDisconnectedServicesJob

func (j *JobScheduler) RunDeleteDisconnectedServicesJob(ctx context.Context) error

func (*JobScheduler) RunDisconnectedServicesJob

func (j *JobScheduler) RunDisconnectedServicesJob(ctx context.Context) error

func (*JobScheduler) Setup

func (j *JobScheduler) Setup() error

SetupScheduler ensures all our jobs exist in the cereal service backend.

func (*JobScheduler) UpdateDeleteDisconnectedServicesJobConfig

func (j *JobScheduler) UpdateDeleteDisconnectedServicesJobConfig(ctx context.Context, conf *DisconnectedServicesConfigV0) error

func (*JobScheduler) UpdateDisconnectedServicesJobConfig

func (j *JobScheduler) UpdateDisconnectedServicesJobConfig(ctx context.Context, conf *DisconnectedServicesConfigV0) error

type MarkDisconnectedServicesExecutor

type MarkDisconnectedServicesExecutor struct {
	ApplicationsServer *ApplicationsServer
	// contains filtered or unexported fields
}

func (*MarkDisconnectedServicesExecutor) Run

func (m *MarkDisconnectedServicesExecutor) Run(ctx context.Context, t cereal.Task) (interface{}, error)

func (*MarkDisconnectedServicesExecutor) TotalRuns

func (m *MarkDisconnectedServicesExecutor) TotalRuns() int64

Jump to

Keyboard shortcuts

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