computecapability

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComputeCapabilityListFilters

type ComputeCapabilityListFilters struct {
	IDIn       []string // IN condition
	NameIn     []string // IN condition
	VersionGte *uint64  // Greater than or equal condition
	VersionLte *uint64  // Less than or equal condition
	VersionEq  *uint64  // Equal condition

	IncludeDeleted bool   // IncludeDeleted indicates whether to include soft-deleted records in the result.
	Limit          uint32 // Limit is the maximum number of records to return.

	StateIn    []ComputeCapabilityState
	StateNotIn []ComputeCapabilityState
	TypeIn     []string
}

ComputeCapabilityFilters contains filters for querying the ComputeCapability table.

type ComputeCapabilityRecord

type ComputeCapabilityRecord struct {
	Metadata core.Metadata           // Metadata is the metadata that identifies the ComputeCapability. It is a combination of the ComputeCapability's name and version.
	Name     string                  // Name is the name of the ComputeCapability.
	Status   ComputeCapabilityStatus // Status is the status of the ComputeCapability.

	Type  string // Type is the type of the ComputeCapability.
	Score uint32 // Score is the score of the ComputeCapability. This is relative to the other ComputeCapabilities of the same type.
}

ComputeCapability is a representation of the ComputeCapability of an application.

type ComputeCapabilityState

type ComputeCapabilityState string

ComputeCapabilityState is the state of a ComputeCapability.

const (
	ComputeCapabilityStateUnknown  ComputeCapabilityState = "ComputeCapabilityState_UNKNOWN"
	ComputeCapabilityStatePending  ComputeCapabilityState = "ComputeCapabilityState_PENDING"
	ComputeCapabilityStateActive   ComputeCapabilityState = "ComputeCapabilityState_ACTIVE"
	ComputeCapabilityStateInActive ComputeCapabilityState = "ComputeCapabilityState_INACTIVE"
)

func ComputeCapabilityStateFromString

func ComputeCapabilityStateFromString(s string) ComputeCapabilityState

FromString converts a string into a ComputeCapabilityState if valid, otherwise returns an error.

func (ComputeCapabilityState) ToString

func (s ComputeCapabilityState) ToString() string

ToString returns the string representation of the ComputeCapabilityState.

type ComputeCapabilityStatus

type ComputeCapabilityStatus struct {
	State   ComputeCapabilityState // State is the discrete condition of the resource.
	Message string                 // Message is a human-readable description of the resource's state.
}

type CreateRequest

type CreateRequest struct {
	Name  string
	Type  string
	Score uint32
}

CreateRequest represents the ComputeCapability creation request.

type CreateResponse

type CreateResponse struct {
	Record ComputeCapabilityRecord
}

CreateResponse represents the response after creating a new ComputeCapability.

type DeleteRequest

type DeleteRequest struct {
	Metadata core.Metadata
}

type GetResponse

type GetResponse struct {
	Record ComputeCapabilityRecord
}

GetResponse represents the response for fetching a ComputeCapability.

type Ledger

type Ledger interface {
	// Create creates a new ComputeCapability.
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	// GetByMetadata retrieves a ComputeCapability by its metadata.
	GetByID(context.Context, string) (*GetResponse, error)
	// GetByName retrieves a ComputeCapability by its name.
	GetByName(context.Context, string) (*GetResponse, error)
	// UpdateStatus updates the state and message of an existing ComputeCapability.
	UpdateStatus(context.Context, *UpdateStateRequest) (*UpdateResponse, error)
	// List returns a list of ComputeCapability that match the provided filters.
	List(context.Context, *ListRequest) (*ListResponse, error)
	// Delete deletes a ComputeCapability.
	Delete(context.Context, *DeleteRequest) error
}

Ledger provides the methods for managing ComputeCapability records.

func NewLedger

func NewLedger(repo Repository) Ledger

NewLedger creates a new Ledger instance.

type ListRequest

type ListRequest struct {
	Filters ComputeCapabilityListFilters
}

ListRequest represents the request to list ComputeCapabilitys with filters.

type ListResponse

type ListResponse struct {
	Records []ComputeCapabilityRecord
}

ListResponse represents the response to a list request.

type Repository

Repository provides the methods that the storage layer must implement to support the ledger.

type UpdateResponse

type UpdateResponse struct {
	Record ComputeCapabilityRecord
}

UpdateResponse represents the response after updating the state of a ComputeCapability.

type UpdateStateRequest

type UpdateStateRequest struct {
	Metadata core.Metadata
	Status   ComputeCapabilityStatus
}

UpdateStateRequest represents the request to update the state and message of a ComputeCapability.

Jump to

Keyboard shortcuts

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