base

package
v0.0.0-...-51c5060 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: CC0-1.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker interface {
	// CreateInstance uses the catalog and parsed request to create an instance for the particular type of service.
	CreateInstance(*catalog.Catalog, string, request.Request) response.Response
	// ModifyInstance uses the catalog and parsed request to modify an existing instance for the particular type of service.
	ModifyInstance(*catalog.Catalog, string, request.Request, Instance) response.Response
	// LastOperation uses the catalog and parsed request to get an instance status for the particular type of service.
	LastOperation(*catalog.Catalog, string, Instance, string) response.Response
	// BindInstance takes the existing instance and binds it to an app.
	BindInstance(*catalog.Catalog, string, request.Request, Instance) response.Response
	// DeleteInstance deletes the existing instance.
	DeleteInstance(*catalog.Catalog, string, Instance) response.Response
	// Supports Async operation
	AsyncOperationRequired(*catalog.Catalog, Instance, Operation) bool
}

Broker is the interface that every type of broker should implement.

type Instance

type Instance struct {
	Uuid string `gorm:"primary_key" sql:"type:varchar(255) PRIMARY KEY"`

	request.Request

	Host string `sql:"size(255)"`
	Port int64

	State InstanceState

	CreatedAt time.Time
	UpdatedAt time.Time
}

func FindBaseInstance

func FindBaseInstance(brokerDb *gorm.DB, id string) (Instance, response.Response)

FindBaseInstance is a helper function to find the base instance of the

type InstanceState

type InstanceState uint8

InstanceState is an enumeration to indicate what state the instance is in.

const (
	// InstanceNotCreated is the default InstanceState that represents an uninitiated instance.
	InstanceNotCreated InstanceState = iota // 0
	// InstanceInProgress indicates that the instance is in a intermediate step.
	InstanceInProgress // 1
	// InstanceReady indicates that the instance is created or modified and ready to be used.
	InstanceReady // 2
	// InstanceGone indicates that the instance is deleted.
	InstanceGone // 3
	// InstanceNotGone indicates that the instance is not deleted.
	InstanceNotGone // 4
	// InstanceNotModified indicates that the instance is not modified.
	InstanceNotModified // 5
)

func (InstanceState) String

func (i InstanceState) String() string

type Operation

type Operation uint8

operation represents the type of async operation a broker may require

const (
	NoOp Operation = iota
	CreateOp
	ModifyOp
	DeleteOp
	BindOp
	UnBindOp
)

func (Operation) String

func (o Operation) String() string

Jump to

Keyboard shortcuts

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