instance

package
v0.0.0-...-a14a4d2 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Mgr = New()

Mgr is the global instance manager instance

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// Save the instance metadata to the backend store
	//
	// inst *Instance : a ptr of instance
	//
	// If succeed, the uuid of the saved instance is returned;
	// otherwise, a non nil error is returned
	//
	Save(ctx context.Context, inst *provider.Instance) (int64, error)

	// Delete the specified instance
	//
	// id int64 : the id of the instance
	//
	// If succeed, a nil error is returned;
	// otherwise, a non nil error is returned
	//
	Delete(ctx context.Context, id int64) error

	// Update the specified instance
	//
	// inst *Instance : a ptr of instance
	//
	// If succeed, a nil error is returned;
	// otherwise, a non nil error is returned
	//
	Update(ctx context.Context, inst *provider.Instance, props ...string) error

	// Get the instance with the ID
	//
	// id int64 : the id of the instance
	//
	// If succeed, a non nil Instance is returned;
	// otherwise, a non nil error is returned
	//
	Get(ctx context.Context, id int64) (*provider.Instance, error)

	// GetByName gets the repository specified by name
	// name string : the global unique name of the instance
	GetByName(ctx context.Context, name string) (*provider.Instance, error)

	// Count the instances by the param
	//
	// query *q.Query : the query params
	Count(ctx context.Context, query *q.Query) (int64, error)

	// Query the instances by the param
	//
	// query *q.Query : the query params
	//
	// If succeed, an instance list is returned;
	// otherwise, a non nil error is returned
	//
	List(ctx context.Context, query *q.Query) ([]*provider.Instance, error)
}

Manager is responsible for storing the instances

func New

func New() Manager

New returns an instance of DefaultManger

Jump to

Keyboard shortcuts

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