account

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CountWorkersResponse

type CountWorkersResponse struct {
	Premium countWorkersData `json:"premium"`
	Free    countWorkersData `json:"free"`
}

CountWorkersResponse is the result.

type Manager

type Manager struct {
	*hosts.Dependencies
	// contains filtered or unexported fields
}

Manager accounts.

func NewManager

func NewManager(q *query.Query, api *api.API, d *hosts.Dependencies) *Manager

NewManager returns a manager instance.

func (*Manager) CountWorkers

func (m *Manager) CountWorkers(ctx context.Context, master string) (*CountWorkersResponse, error)

CountWorkers counts total workers info for the master.

func (*Manager) CreateWorker

func (m *Manager) CreateWorker(ctx context.Context, master string, status Status) (*model.WorkerAccount, error)

func (*Manager) GetMaster

func (m *Manager) GetMaster(ctx context.Context, keepShareUserID string) (*model.MasterAccount, error)

GetMaster get bound account, if not found, create a master account and bind to this user.

func (*Manager) GetWorkerWithEnoughCapacity

func (m *Manager) GetWorkerWithEnoughCapacity(ctx context.Context, master string, size int64, status Status) (*model.WorkerAccount, error)

GetWorkerWithEnoughCapacity get or create a worker account with sufficient capacity and with the smallest remaining capacity.

type Status

type Status int

Status identifies whether this account is a premium.

const (
	IsPremium Status
	NotPremium
)

enum statuses.

Jump to

Keyboard shortcuts

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