mongo

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mongo

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

func NewMongo

func NewMongo(host string, database string) (*Mongo, error)

func NewMongoWithDb

func NewMongoWithDb(db *mongo.Database) *Mongo

func (*Mongo) CollectMetrics

func (m *Mongo) CollectMetrics(ctx context.Context) error

func (*Mongo) CreateTask

func (m *Mongo) CreateTask(ctx context.Context, task *stepper.Task) error

func (*Mongo) FailTask

func (m *Mongo) FailTask(ctx context.Context, task *stepper.Task, handlerErr error, timeout time.Duration) error

func (*Mongo) FindNextJob

func (m *Mongo) FindNextJob(ctx context.Context, statuses []string) (*stepper.Job, error)

func (*Mongo) FindNextTask

func (m *Mongo) FindNextTask(ctx context.Context, statuses []string) (*stepper.Task, error)

func (*Mongo) FindTask added in v0.0.3

func (m *Mongo) FindTask(ctx context.Context, name string) (*stepper.Task, error)

func (*Mongo) GetRelatedTask

func (m *Mongo) GetRelatedTask(ctx context.Context, task *stepper.Task) (*stepper.Task, error)

func (*Mongo) GetUnreleasedJobChildren

func (m *Mongo) GetUnreleasedJobChildren(ctx context.Context, jobId string) (*stepper.Task, error)

func (*Mongo) GetUnreleasedTaskChildren

func (m *Mongo) GetUnreleasedTaskChildren(ctx context.Context, forTask *stepper.Task) (*stepper.Task, error)

func (*Mongo) Init

func (m *Mongo) Init(ctx context.Context) error

TODO add indexes

func (*Mongo) RegisterJob

func (m *Mongo) RegisterJob(ctx context.Context, cfg *stepper.JobConfig) error

func (*Mongo) Release

func (m *Mongo) Release(ctx context.Context, job *stepper.Job, nextTimeLaunch time.Time) error

func (*Mongo) ReleaseTask

func (m *Mongo) ReleaseTask(ctx context.Context, task *stepper.Task) error

func (*Mongo) SetState

func (m *Mongo) SetState(ctx context.Context, task *stepper.Task, state []byte) error

func (*Mongo) UpdateTask added in v0.0.2

func (m *Mongo) UpdateTask(ctx context.Context, name string, updatedLaunchAt time.Time) error

func (*Mongo) WaitForSubtasks

func (m *Mongo) WaitForSubtasks(ctx context.Context, job *stepper.Job) error

func (*Mongo) WaitTaskForSubtasks

func (m *Mongo) WaitTaskForSubtasks(ctx context.Context, task *stepper.Task) error

type Task

type Task struct {
	ID               string            `bson:"id"`
	CustomId         string            `bson:"custom_id"`
	Name             string            `bson:"name"`
	Data             []byte            `bson:"data"`
	JobId            string            `bson:"jobId"`
	Parent           string            `bson:"parent"`
	LaunchAt         time.Time         `bson:"launchAt"`
	Status           string            `bson:"status"`
	LockAt           *time.Time        `bson:"lock_at"`
	State            []byte            `bson:"state"`
	MiddlewaresState map[string][]byte `bson:"middlewares_state"`
}

func (*Task) FromModel

func (t *Task) FromModel(model *stepper.Task)

func (*Task) ToModel

func (t *Task) ToModel() *stepper.Task

Jump to

Keyboard shortcuts

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