projects

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MinRetryTime defines the minimum time duration between retries
	MinRetryTime = 30 * time.Second

	// MaxRetryCount defines the maximum number of retries allowed
	MaxRetryCount = 1
)

Functions

This section is empty.

Types

type CreateFailed

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

CreateFailed indicates that node selection has failed

func (CreateFailed) FormatError

func (evt CreateFailed) FormatError(xerrors.Printer) (next error)

FormatError Format error

type Datastore

type Datastore struct {
	dtypes.ServerID
	// contains filtered or unexported fields
}

Datastore represents the project datastore

func NewDatastore

func NewDatastore(db *db.SQLDB, serverID dtypes.ServerID) *Datastore

NewDatastore creates a new projectDatastore

func (*Datastore) Batch

func (d *Datastore) Batch(ctx context.Context) (datastore.Batch, error)

Batch batch

func (*Datastore) Close

func (d *Datastore) Close() error

Close closes the project datastore

func (*Datastore) Delete

func (d *Datastore) Delete(ctx context.Context, key datastore.Key) error

Delete delete project record info (This func has no place to call it)

func (*Datastore) Get

func (d *Datastore) Get(ctx context.Context, key datastore.Key) (value []byte, err error)

Get retrieves data from the datastore

func (*Datastore) GetSize

func (d *Datastore) GetSize(ctx context.Context, key datastore.Key) (size int, err error)

GetSize gets the data size from the datastore

func (*Datastore) Has

func (d *Datastore) Has(ctx context.Context, key datastore.Key) (exists bool, err error)

Has checks if the key exists in the datastore

func (*Datastore) Put

func (d *Datastore) Put(ctx context.Context, key datastore.Key, value []byte) error

Put update project record info

func (*Datastore) Query

func (d *Datastore) Query(ctx context.Context, q query.Query) (query.Results, error)

Query queries project records from the datastore

func (*Datastore) Sync

func (d *Datastore) Sync(ctx context.Context, prefix datastore.Key) error

Sync sync

type DeployFailed

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

DeployFailed indicates that a node has failed to pull an project

func (DeployFailed) FormatError

func (evt DeployFailed) FormatError(xerrors.Printer) (next error)

FormatError Format error

func (DeployFailed) Ignore

func (evt DeployFailed) Ignore()

type DeployRequestSent

type DeployRequestSent struct{}

DeployRequestSent indicates that a pull request has been sent

type DeployResult

type DeployResult struct {
	BlocksCount int64
	Size        int64
}

DeployResult represents the result of node starting

func (DeployResult) Ignore

func (evt DeployResult) Ignore()

type DeploySucceed

type DeploySucceed struct{}

DeploySucceed indicates that a node has successfully pulled an project

func (DeploySucceed) Ignore

func (evt DeploySucceed) Ignore()

type Ignorable

type Ignorable interface {
	Ignore()
}

Ignorable Ignorable

type Manager

type Manager struct {
	*db.SQLDB
	// contains filtered or unexported fields
}

Manager manages project replicas

func NewManager

func NewManager(nodeManager *node.Manager, sdb *db.SQLDB, ds datastore.Batching) *Manager

NewManager returns a new projectManager instance

func (*Manager) CheckProjectReplicasFromNode

func (m *Manager) CheckProjectReplicasFromNode(nodeID string)

func (*Manager) Delete

func (m *Manager) Delete(req *types.ProjectReq) error

func (*Manager) Deploy

func (m *Manager) Deploy(req *types.DeployProjectReq) error

func (*Manager) GetProjectInfo

func (m *Manager) GetProjectInfo(uuid string) (*types.ProjectInfo, error)

func (*Manager) ListProjects

func (m *Manager) ListProjects() ([]ProjectInfo, error)

ListProjects load project pull infos from state machine

func (*Manager) Plan

func (m *Manager) Plan(events []statemachine.Event, user interface{}) (interface{}, uint64, error)

Plan prepares a plan for project start

func (*Manager) RestartDeployProjects

func (m *Manager) RestartDeployProjects(ids []string) error

RestartDeployProjects restarts deploy projects

func (*Manager) StartTimer

func (m *Manager) StartTimer(ctx context.Context)

Start initializes and starts the project state machine and associated tickers

func (*Manager) Terminate

func (m *Manager) Terminate(ctx context.Context) error

Terminate stops the project state machine

func (*Manager) Update

func (m *Manager) Update(req *types.ProjectReq) error

func (*Manager) UpdateStatus

func (m *Manager) UpdateStatus(nodeID string, list []*types.Project) error

type ProjectForceState

type ProjectForceState struct {
	State   ProjectState
	Details string
	NodeIDs []string
	Event   int64
}

ProjectForceState forces an project state

type ProjectID

type ProjectID string

ProjectID is an identifier for a project.

func (ProjectID) String

func (c ProjectID) String() string

type ProjectInfo

type ProjectInfo struct {
	// uuid
	UUID      ProjectID
	State     ProjectState
	Name      string
	BundleURL string
	Replicas  int64

	CPUCores int64
	Memory   int64
	AreaID   string

	UserID string

	DetailsList []string

	EdgeReplicaSucceeds []string
	EdgeWaitings        int64
	RetryCount          int64
	ReplenishReplicas   int64

	NodeIDs []string
	Event   int64
}

ProjectInfo

func (*ProjectInfo) MarshalCBOR

func (t *ProjectInfo) MarshalCBOR(w io.Writer) error

func (*ProjectInfo) ToProjectInfo

func (state *ProjectInfo) ToProjectInfo() *types.ProjectInfo

ToProjectInfo converts ProjectInfo to types.ProjectInfo

func (*ProjectInfo) UnmarshalCBOR

func (t *ProjectInfo) UnmarshalCBOR(r io.Reader) (err error)

type ProjectRedeploy

type ProjectRedeploy struct{}

ProjectRedeploy re-pull the project

func (ProjectRedeploy) Ignore

func (evt ProjectRedeploy) Ignore()

type ProjectRestart

type ProjectRestart struct{}

ProjectRestart restarts project

type ProjectState

type ProjectState string
const (
	NodeSelect ProjectState = "NodeSelect"
	Update     ProjectState = "Update"
	Deploying  ProjectState = "Deploying"
	Servicing  ProjectState = "Servicing"
	Failed     ProjectState = "Failed"
	Remove     ProjectState = "Remove"
)

func (ProjectState) String

func (ps ProjectState) String() string

String status to string

type SkipStep

type SkipStep struct{}

SkipStep skips the current step

type UpdateFailed

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

UpdateFailed indicates that node selection has failed

func (UpdateFailed) FormatError

func (evt UpdateFailed) FormatError(xerrors.Printer) (next error)

FormatError Format error

type UpdateRequestSent

type UpdateRequestSent struct{}

UpdateRequestSent indicates that a pull request has been sent

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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