scheduler

package
v0.0.0-...-7b61fee Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

README

EdgeX Foundry Support Scheduler Service

Go implementation of EdgeX Support Scheduler.

Installation and Execution

To fetch the code and build the microservice execute the following:

cd $GOPATH/src
go get github.com/Circutor/edgex
cd $GOPATH/src/github.com/Circutor/edgex
# pull the 3rd party / vendor packages
make prepare
# build the microservice
make cmd/support-scheduler/support-scheduler
# get to the support logging microservice executable
cd cmd/support-scheduler
# run the microservice (may require other dependent services to run correctly)
./support-scheduler

To test, simple run:

cd $GOPATH/src
go get github.com/Circutor/edgex
# pull the 3rd party / vendor packages
make prepare
# build the microservice
make cmd/support-scheduler/support-scheduler
# exectute the go test(s)
go test

Community

License

Apache-2.0

Documentation

Overview

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2017 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2018 Dell Inc.
  • Copyright (c) 2019 Intel Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License

* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. ******************************************************************************

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

Copyright (c) 2018 Dell Inc.

SPDX-License-Identifier: Apache-2.0

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

Index

Constants

View Source
const (

	/* -------------- Constants for Scheduler -------------------- */
	ID                   = "id"
	NAME                 = "name"
	TARGETNAME           = "targetname"
	INTERVALACTION       = "intervalaction"
	INTERVAL             = "interval"
	LABEL                = "label"
	YAML                 = "yaml"
	COMMAND              = "command"
	KEY                  = "key"
	VALUE                = "value"
	UNLOCKED             = "UNLOCKED"
	ENABLED              = "ENABLED"
	SCHEDULER_TIMELAYOUT = "20060102T150405" /** Scheduler **/
	TIMELAYOUT           = "20060102T150405" /** Scheduler **/

	/* ---------------- URL PARAM NAMES -----------------------*/
	ContentTypeKey       = "Content-Type"
	ContentTypeJsonValue = "application/json; charset=utf-8"
	ContentLengthKey     = "Content-Length"
)

Variables

View Source
var LoggingClient logger.LoggingClient

Functions

func Destruct

func Destruct()

func Init

func Init() bool

func LoadRestRoutes

func LoadRestRoutes() *mux.Router

func LoadScheduler

func LoadScheduler() error

Utility function for adding configured locally intervals and scheduled events

func Retry

func Retry(useProfile string, timeout int, wait *sync.WaitGroup, ch chan error)

func StartTicker

func StartTicker()

func StopTicker

func StopTicker()

Types

type ConfigurationStruct

type ConfigurationStruct struct {
	Writable        WritableInfo
	Clients         map[string]config.ClientInfo
	Databases       map[string]config.DatabaseInfo
	Logging         config.LoggingInfo
	Service         config.ServiceInfo
	Intervals       map[string]config.IntervalInfo
	IntervalActions map[string]config.IntervalActionInfo
}

Configuration V2 for the Support Scheduler Service

var Configuration *ConfigurationStruct

type IntervalContext

type IntervalContext struct {
	Interval           models.Interval
	IntervalActionsMap map[string]models.IntervalAction
	StartTime          time.Time
	EndTime            time.Time
	NextTime           time.Time
	Frequency          time.Duration
	CurrentIterations  int64
	MaxIterations      int64
	MarkedDeleted      bool
}

func (*IntervalContext) GetInfo

func (sc *IntervalContext) GetInfo() string

func (*IntervalContext) IsComplete

func (sc *IntervalContext) IsComplete() bool

func (*IntervalContext) Reset

func (sc *IntervalContext) Reset(interval models.Interval)

func (*IntervalContext) UpdateIterations

func (sc *IntervalContext) UpdateIterations()

func (*IntervalContext) UpdateNextTime

func (sc *IntervalContext) UpdateNextTime()

type QueueClient

type QueueClient struct {
}

Scheduler Queue Client

func NewSchedulerQueueClient

func NewSchedulerQueueClient() *QueueClient

NewClient

func (*QueueClient) AddIntervalActionToQueue

func (qc *QueueClient) AddIntervalActionToQueue(intervalAction contract.IntervalAction) error

func (*QueueClient) AddIntervalToQueue

func (qc *QueueClient) AddIntervalToQueue(interval contract.Interval) error

func (*QueueClient) Connect

func (qc *QueueClient) Connect() (string, error)

func (*QueueClient) QueryIntervalActionByID

func (qc *QueueClient) QueryIntervalActionByID(intervalActionId string) (contract.IntervalAction, error)

func (*QueueClient) QueryIntervalActionByName

func (qc *QueueClient) QueryIntervalActionByName(intervalActionName string) (contract.IntervalAction, error)

func (*QueueClient) QueryIntervalByID

func (qc *QueueClient) QueryIntervalByID(intervalId string) (contract.Interval, error)

func (*QueueClient) QueryIntervalByName

func (qc *QueueClient) QueryIntervalByName(intervalName string) (contract.Interval, error)

func (*QueueClient) RemoveIntervalActionQueue

func (qc *QueueClient) RemoveIntervalActionQueue(intervalActionId string) error

func (*QueueClient) RemoveIntervalInQueue

func (qc *QueueClient) RemoveIntervalInQueue(intervalId string) error

func (*QueueClient) UpdateIntervalActionQueue

func (qc *QueueClient) UpdateIntervalActionQueue(intervalAction contract.IntervalAction) error

func (*QueueClient) UpdateIntervalInQueue

func (qc *QueueClient) UpdateIntervalInQueue(interval contract.Interval) error

type WritableInfo

type WritableInfo struct {
	ScheduleIntervalTime int
	LogLevel             string
}

Directories

Path Synopsis
****************************************************************************** * Copyright 2018 Dell Inc.
****************************************************************************** * Copyright 2018 Dell Inc.
****************************************************************************** * Copyright 2018 Dell Inc.
****************************************************************************** * Copyright 2018 Dell Inc.

Jump to

Keyboard shortcuts

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