worker

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory interface {
	CheckIP(ctx kratosx.Context, ip string) error
}

type GetWorkerGroupRequest

type GetWorkerGroupRequest struct {
	Id *uint32 `json:"id"`
}

type GetWorkerRequest

type GetWorkerRequest struct {
	Id *uint32 `json:"id"`
	Ip *string `json:"ip"`
}

type ListWorkerGroupRequest

type ListWorkerGroupRequest struct {
	Page     uint32  `json:"page"`
	PageSize uint32  `json:"pageSize"`
	Order    *string `json:"order"`
	OrderBy  *string `json:"orderBy"`
	Name     *string `json:"name"`
}

type ListWorkerRequest

type ListWorkerRequest struct {
	Page     uint32  `json:"page"`
	PageSize uint32  `json:"pageSize"`
	Order    *string `json:"order"`
	OrderBy  *string `json:"orderBy"`
	Name     *string `json:"name"`
	Ip       *string `json:"ip"`
	GroupId  *uint32 `json:"groupId"`
	Status   *bool   `json:"status"`
}

type Repo

type Repo interface {
	// GetWorkerGroup 获取指定的节点分组
	GetWorkerGroup(ctx kratosx.Context, id uint32) (*WorkerGroup, error)

	// ListWorkerGroup 获取节点分组列表
	ListWorkerGroup(ctx kratosx.Context, req *ListWorkerGroupRequest) ([]*WorkerGroup, uint32, error)

	// CreateWorkerGroup 创建节点分组
	CreateWorkerGroup(ctx kratosx.Context, req *WorkerGroup) (uint32, error)

	// UpdateWorkerGroup 更新节点分组
	UpdateWorkerGroup(ctx kratosx.Context, req *WorkerGroup) error

	// DeleteWorkerGroup 删除节点分组
	DeleteWorkerGroup(ctx kratosx.Context, id uint32) error

	// GetWorker 获取指定的节点信息
	GetWorker(ctx kratosx.Context, id uint32) (*Worker, error)

	// ListWorker 获取节点信息列表
	ListWorker(ctx kratosx.Context, req *ListWorkerRequest) ([]*Worker, uint32, error)

	// CreateWorker 创建节点信息
	CreateWorker(ctx kratosx.Context, req *Worker) (uint32, error)

	// UpdateWorker 更新节点信息
	UpdateWorker(ctx kratosx.Context, req *Worker) error

	// UpdateWorkerStatus 更新节点信息状态
	UpdateWorkerStatus(ctx kratosx.Context, id uint32, status bool) error

	// DeleteWorker 删除节点信息
	DeleteWorker(ctx kratosx.Context, id uint32) error

	// GetWorkerByIp 获取指定的节点信息
	GetWorkerByIp(ctx kratosx.Context, ip string) (*Worker, error)

	// GetWorkerByGroupId 获取随机节点
	GetWorkerByGroupId(ctx kratosx.Context, id uint32) (*Worker, error)
}

type UseCase

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

func NewUseCase

func NewUseCase(config *conf.Config, repo Repo, factory Factory) *UseCase

func (*UseCase) CreateWorker

func (u *UseCase) CreateWorker(ctx kratosx.Context, req *Worker) (uint32, error)

CreateWorker 创建节点信息

func (*UseCase) CreateWorkerGroup

func (u *UseCase) CreateWorkerGroup(ctx kratosx.Context, req *WorkerGroup) (uint32, error)

CreateWorkerGroup 创建节点分组

func (*UseCase) DeleteWorker

func (u *UseCase) DeleteWorker(ctx kratosx.Context, id uint32) error

DeleteWorker 删除节点信息

func (*UseCase) DeleteWorkerGroup

func (u *UseCase) DeleteWorkerGroup(ctx kratosx.Context, id uint32) error

DeleteWorkerGroup 删除节点分组

func (*UseCase) GetWorker

func (u *UseCase) GetWorker(ctx kratosx.Context, req *GetWorkerRequest) (*Worker, error)

GetWorker 获取指定的节点信息

func (*UseCase) GetWorkerGroup

func (u *UseCase) GetWorkerGroup(ctx kratosx.Context, req *GetWorkerGroupRequest) (*WorkerGroup, error)

GetWorkerGroup 获取指定的节点分组

func (*UseCase) ListWorker

func (u *UseCase) ListWorker(ctx kratosx.Context, req *ListWorkerRequest) ([]*Worker, uint32, error)

ListWorker 获取节点信息列表

func (*UseCase) ListWorkerGroup

func (u *UseCase) ListWorkerGroup(ctx kratosx.Context, req *ListWorkerGroupRequest) ([]*WorkerGroup, uint32, error)

ListWorkerGroup 获取节点分组列表

func (*UseCase) UpdateWorker

func (u *UseCase) UpdateWorker(ctx kratosx.Context, req *Worker) error

UpdateWorker 更新节点信息

func (*UseCase) UpdateWorkerGroup

func (u *UseCase) UpdateWorkerGroup(ctx kratosx.Context, req *WorkerGroup) error

UpdateWorkerGroup 更新节点分组

func (*UseCase) UpdateWorkerStatus

func (u *UseCase) UpdateWorkerStatus(ctx kratosx.Context, id uint32, status bool) error

UpdateWorkerStatus 更新节点信息状态

type Worker

type Worker struct {
	Id          uint32       `json:"id"`
	Name        string       `json:"name"`
	Ip          string       `json:"ip"`
	GroupId     *uint32      `json:"groupId"`
	Status      *bool        `json:"status"`
	Description *string      `json:"description"`
	CreatedAt   int64        `json:"createdAt"`
	UpdatedAt   int64        `json:"updatedAt"`
	Group       *WorkerGroup `json:"group"`
}

type WorkerGroup

type WorkerGroup struct {
	Id          uint32  `json:"id"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	CreatedAt   int64   `json:"createdAt"`
	UpdatedAt   int64   `json:"updatedAt"`
}

Jump to

Keyboard shortcuts

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