Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterListFilters ¶
type ClusterListFilters 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 []ClusterState
StateNotIn []ClusterState
}
ClusterFilters contains filters for querying the Cluster table.
type ClusterRecord ¶
type ClusterRecord struct {
Metadata core.Metadata // Metadata is the metadata that identifies the Cluster. It is a combination of the Cluster's name and version.
Name string // Name is the name of the Cluster.
Status ClusterStatus // Status is the status of the Cluster.
}
Cluster is a representation of the Cluster of an application.
type ClusterState ¶
type ClusterState string
ClusterState is the state of a Cluster.
const ( ClusterStateUnknown ClusterState = "ClusterState_UNKNOWN" ClusterStatePending ClusterState = "ClusterState_PENDING" ClusterStateActive ClusterState = "ClusterState_ACTIVE" ClusterStateInActive ClusterState = "ClusterState_INACTIVE" )
func ClusterStateFromString ¶
func ClusterStateFromString(s string) ClusterState
FromString converts a string into a ClusterState if valid, otherwise returns an error.
func (ClusterState) ToString ¶
func (s ClusterState) ToString() string
ToString returns the string representation of the ClusterState.
type ClusterStatus ¶
type ClusterStatus struct {
State ClusterState // 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
}
CreateRequest represents the Cluster creation request.
type CreateResponse ¶
type CreateResponse struct {
Record ClusterRecord
}
CreateResponse represents the response after creating a new Cluster.
type DeleteRequest ¶
type GetResponse ¶
type GetResponse struct {
Record ClusterRecord
}
GetResponse represents the response for fetching a Cluster.
type Ledger ¶
type Ledger interface {
// Create creates a new Cluster.
Create(context.Context, *CreateRequest) (*CreateResponse, error)
// GetByID retrieves a Cluster by its ID.
GetByID(context.Context, string) (*GetResponse, error)
// GetByName retrieves a Cluster by its name.
GetByName(context.Context, string) (*GetResponse, error)
// UpdateStatus updates the state and message of an existing Cluster.
UpdateStatus(context.Context, *UpdateStateRequest) (*UpdateResponse, error)
// List returns a list of Cluster that match the provided filters.
List(context.Context, *ListRequest) (*ListResponse, error)
// Delete deletes a Cluster.
Delete(context.Context, *DeleteRequest) error
}
Ledger provides the methods for managing Cluster records.
type ListRequest ¶
type ListRequest struct {
Filters ClusterListFilters
}
ListRequest represents the request to list Clusters with filters.
type ListResponse ¶
type ListResponse struct {
Records []ClusterRecord
}
ListResponse represents the response to a list request.
type Repository ¶
type Repository interface {
Insert(context.Context, ClusterRecord) error
GetByID(context.Context, string) (ClusterRecord, error)
GetByName(context.Context, string) (ClusterRecord, error)
UpdateStatus(context.Context, core.Metadata, ClusterStatus) error
Delete(context.Context, core.Metadata) error
List(context.Context, ClusterListFilters) ([]ClusterRecord, error)
}
Repository provides the methods that the storage layer must implement to support the ledger.
type UpdateResponse ¶
type UpdateResponse struct {
Record ClusterRecord
}
UpdateResponse represents the response after updating the state of a Cluster.
type UpdateStateRequest ¶
type UpdateStateRequest struct {
Metadata core.Metadata
Status ClusterStatus
}
UpdateStateRequest represents the request to update the state and message of a Cluster.