repository

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobCollectionName = "job"
)
View Source
const (
	NodeRegistryCollection = "node-registry"
)
View Source
const (
	TaskCollectionName = "task"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IJob

type IJob interface {
	Insert(ctx context.Context, job models.Job) (insertedJobID *primitive.ObjectID, err error)
	FindAll(ctx context.Context) ([]models.Job, error)
	FindOneByDocumentID(ctx context.Context, id primitive.ObjectID) (*models.Job, error)
	FindJobToDistribute(ctx context.Context) ([]models.Job, error)
	UpdateJobStatusByID(ctx context.Context, job models.Job) error
}

func ProvideJob

func ProvideJob(database *mongo.Database) IJob

type INodeRegistry

type INodeRegistry interface {
	IsNodeAlreadyRegistered(ctx context.Context, keyHash string) (bool, error)
	RegisterWorkerNodeWithCertificate(ctx context.Context, ip string, port int32, certificate cert.TLSCertificate) error
	GetAllWorkerNode(ctx context.Context) ([]models.NodeEntry, error)
	GetNode(ctx context.Context, nodeID string) (*models.NodeEntry, error)
	UpdateNodeStatByID(ctx context.Context, nodeEntry models.NodeEntry) error
}

func ProvideControlPlane

func ProvideControlPlane(database *mongo.Database) INodeRegistry

type ITask

type ITask interface {
	FindOneByID(ctx context.Context, taskID primitive.ObjectID) (*models.Task, error)
	FindManyByJobID(ctx context.Context, jobID *primitive.ObjectID) ([]models.Task, error)
	CountUnfinishedTaskByJobID(ctx context.Context, jobID *primitive.ObjectID) (int64, error)
	InsertMany(ctx context.Context, tasks []models.Task) error
	GetTaskToDistributeForJob(ctx context.Context, jobID *primitive.ObjectID) ([]models.Task, error)
	BulkWriteStatusAndLogByID(ctx context.Context, tasks []models.Task) error
	WriteTaskResult(ctx context.Context, task models.Task) error
	FindFinishedTask(ctx context.Context, jobID *primitive.ObjectID) ([]models.Task, error)
	UpdateTaskStatusByJobID(ctx context.Context, jobID *primitive.ObjectID, status models.Task) error
	FindTaskByStatus(ctx context.Context, taskStatus models.TaskStatus) ([]models.Task, error)
}

func ProvideTask

func ProvideTask(database *mongo.Database) ITask

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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