gcloud

package module
Version: v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

README

gtasks-scheduler

External scheduler using Google Cloud Tasks

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeoutTypeName = "gsched-timeout"

Functions

This section is empty.

Types

type DBWorkflow

type DBWorkflow struct {
	Meta     async.State
	State    interface{} // json body of workflow state
	LockTill time.Time   // optimistic locking
}

type FirestoreEngine

type FirestoreEngine struct {
	Scheduler  *GTasksScheduler
	Runner     async.Runner
	DB         *firestore.Client
	Collection string
	Workflows  map[string]func() async.WorkflowState
}

func (FirestoreEngine) Checkpoint

func (fs FirestoreEngine) Checkpoint(ctx context.Context, wf DBWorkflow, s async.WorkflowState) func(bool) error

func (FirestoreEngine) Get

func (fs FirestoreEngine) Get(ctx context.Context, id string) (*DBWorkflow, error)

func (FirestoreEngine) Lock

func (fs FirestoreEngine) Lock(ctx context.Context, id string) (DBWorkflow, error)

func (FirestoreEngine) OnCallback

func (fs FirestoreEngine) OnCallback(ctx context.Context, id string, cb async.CallbackRequest, input interface{}) (interface{}, error)

func (FirestoreEngine) OnResume

func (fs FirestoreEngine) OnResume(ctx context.Context, id string) error

func (FirestoreEngine) ScheduleAndCreate

func (fs FirestoreEngine) ScheduleAndCreate(ctx context.Context, id, name string, state interface{}) error

func (FirestoreEngine) Unlock

func (fs FirestoreEngine) Unlock(ctx context.Context, id string) error

type GTasksScheduler

type GTasksScheduler struct {
	Engine     *FirestoreEngine
	C          *cloudtasks.Service
	Collection string
	ProjectID  string
	LocationID string
	QueueName  string
	ResumeURL  string
}

func (*GTasksScheduler) ResumeHandler

func (s *GTasksScheduler) ResumeHandler(w http.ResponseWriter, r *http.Request)

func (*GTasksScheduler) Schedule

func (mgr *GTasksScheduler) Schedule(ctx context.Context, id string) error

type Request

type Request struct {
	ID  string
	Req *async.CallbackRequest
}

type TimeoutHandler

type TimeoutHandler struct {
	Delay time.Duration
	// contains filtered or unexported fields
}

func (*TimeoutHandler) Handle

func (t *TimeoutHandler) Handle(ctx context.Context, req async.CallbackRequest, input interface{}) (interface{}, error)

func (*TimeoutHandler) Setup added in v0.5.3

func (*TimeoutHandler) Teardown added in v0.5.3

func (t *TimeoutHandler) Teardown(ctx context.Context, req async.CallbackRequest) error

func (*TimeoutHandler) Type

func (t *TimeoutHandler) Type() string

type TimeoutMgr

type TimeoutMgr struct {
	Engine      *FirestoreEngine
	C           *cloudtasks.Service
	Collection  string
	ProjectID   string
	LocationID  string
	QueueName   string
	CallbackURL string
}

func (*TimeoutMgr) Delay added in v0.5.3

func (t *TimeoutMgr) Delay(dur time.Duration) *TimeoutHandler

func (*TimeoutMgr) Setup

func (mgr *TimeoutMgr) Setup(ctx context.Context, req async.CallbackRequest) error

func (*TimeoutMgr) Teardown

func (t *TimeoutMgr) Teardown(ctx context.Context, req async.CallbackRequest) error

func (*TimeoutMgr) TimeoutHandler

func (mgr *TimeoutMgr) TimeoutHandler(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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