Documentation
¶
Index ¶
- type AddCapabilityRequest
- type AddDisruptionRequest
- type CreateRequest
- type CreateResponse
- type DeleteRequest
- type Disruption
- type DisruptionState
- type DisruptionStatus
- type GetResponse
- type Ledger
- type ListRequest
- type ListResponse
- type LocalVolume
- type NodeListFilters
- type NodeRecord
- type NodeState
- type NodeStatus
- type RemoveCapabilityRequest
- type RemoveDisruptionRequest
- type Repository
- type Resources
- type UpdateDisruptionStatusRequest
- type UpdateResponse
- type UpdateStatusRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddCapabilityRequest ¶
type AddDisruptionRequest ¶
type AddDisruptionRequest struct {
Metadata core.Metadata
Disruption Disruption
}
type CreateRequest ¶
type CreateRequest struct {
Name string // Name is the name of the Node.
UpdateDomain string // UpdateDomain is the update domain of the Node.
TotalResources Resources // TotalResources is the total resources available on the Node.
SystemReservedResources Resources // SystemReservedResources is the resources reserved for system use.
CapabilityIDs []string // Capabilities is a list of capabilities that the Node has.
LocalVolumes []LocalVolume
}
CreateRequest represents the Node creation request.
type CreateResponse ¶
type CreateResponse struct {
Record NodeRecord
}
CreateResponse represents the response after creating a new Node.
type DeleteRequest ¶
type Disruption ¶
type Disruption struct {
ID string
ShouldEvict bool
StartTime time.Time
Status DisruptionStatus
}
type DisruptionState ¶
type DisruptionState string
const ( DisruptionStateUnknown DisruptionState = "DisruptionState_UNKNOWN" DisruptionStateScheduled DisruptionState = "DisruptionState_SCHEDULED" DisruptionStateApproved DisruptionState = "DisruptionState_APPROVED" DisruptionStateCompleted DisruptionState = "DisruptionState_COMPLETED" )
type DisruptionStatus ¶
type DisruptionStatus struct {
State DisruptionState
Message string
}
type GetResponse ¶
type GetResponse struct {
Record NodeRecord
}
GetResponse represents the response for fetching a Node.
type Ledger ¶
type Ledger interface {
// Create creates a new Node.
Create(context.Context, *CreateRequest) (*CreateResponse, error)
// GetByID retrieves a Node by its ID
GetByID(context.Context, string) (*GetResponse, error)
// GetByName retrieves a Node by its name.
GetByName(context.Context, string) (*GetResponse, error)
// UpdateStatus updates the state and message of an existing Node.
UpdateStatus(context.Context, *UpdateStatusRequest) (*UpdateResponse, error)
// List returns a list of Node that match the provided filters.
List(context.Context, *ListRequest) (*ListResponse, error)
// Delete deletes a Node.
Delete(context.Context, *DeleteRequest) error
AddDisruption(context.Context, *AddDisruptionRequest) (*UpdateResponse, error)
UpdateDisruptionStatus(context.Context, *UpdateDisruptionStatusRequest) (*UpdateResponse, error)
RemoveDisruption(context.Context, *RemoveDisruptionRequest) (*UpdateResponse, error)
AddCapability(context.Context, *AddCapabilityRequest) (*UpdateResponse, error)
RemoveCapability(context.Context, *RemoveCapabilityRequest) (*UpdateResponse, error)
}
Ledger provides the methods for managing Node records.
type ListRequest ¶
type ListRequest struct {
Filters NodeListFilters
}
ListRequest represents the request to list Nodes with filters.
type ListResponse ¶
type ListResponse struct {
Records []NodeRecord
}
ListResponse represents the response to a list request.
type LocalVolume ¶
type NodeListFilters ¶
type NodeListFilters 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 []NodeState
StateNotIn []NodeState
RemainingCoresGte *uint32
RemainingCoresLte *uint32
RemainingMemoryGte *uint32
RemainingMemoryLte *uint32
ClusterIDIn []string
UpdateDomainIn []string
PayloadNameIn []string
PayloadNameNotIn []string
}
NodeFilters contains filters for querying the Node table.
type NodeRecord ¶
type NodeRecord struct {
Metadata core.Metadata // Metadata is the metadata that identifies the Node. It is a combination of the Node's name and version.
Name string // Name is the name of the Node.
Status NodeStatus // Status is the status of the Node.
ClusterID string // ClusterID is the ID of the Cluster to which the Node belongs.
UpdateDomain string // UpdateDomain is the update domain of the Node.
TotalResources Resources // TotalResources is the total resources available on the Node.
SystemReservedResources Resources // SystemReservedResources is the resources reserved for system use.
RemainingResources Resources // RemainingResources is the resources available for application use.
LocalVolumes []LocalVolume // LocalVolumes is a list of local volumes attached to the Node.
CapabilityIDs []string // Capabilities is a list of capabilities that the Node has.
Disruptions []Disruption // Disruptions is a list of disruptions that are scheduled or approved for the Node.
}
Node is a representation of the Node of an application.
type NodeState ¶
type NodeState string
NodeState is the state of a Node.
const ( NodeStateUnknown NodeState = "NodeState_UNKNOWN" NodeStateUnallocated NodeState = "NodeState_UNALLOCATED" NodeStateAllocating NodeState = "NodeState_ALLOCATING" NodeStateAllocated NodeState = "NodeState_ALLOCATED" NodeStateEvicted NodeState = "NodeState_EVICTED" NodeStateSanitizing NodeState = "NodeState_SANITIZING" )
type NodeStatus ¶
type RemoveCapabilityRequest ¶
type RemoveDisruptionRequest ¶
type Repository ¶
type Repository interface {
Insert(context.Context, NodeRecord) error
GetByID(context.Context, string) (NodeRecord, error)
GetByName(context.Context, string) (NodeRecord, error)
UpdateStatus(context.Context, core.Metadata, NodeStatus, string) error
Delete(context.Context, core.Metadata) error
List(context.Context, NodeListFilters) ([]NodeRecord, error)
InsertDisruption(context.Context, core.Metadata, Disruption) error
DeleteDisruption(ctx context.Context, metadata core.Metadata, disruptionID string) error
UpdateDisruptionStatus(ctx context.Context, metadata core.Metadata, disruptionID string, status DisruptionStatus) error
InsertCapability(ctx context.Context, metadata core.Metadata, capabilityID string) error
DeleteCapability(ctx context.Context, metadata core.Metadata, capabilityID string) error
}
Repository provides the methods that the storage layer must implement to support the ledger.
type UpdateDisruptionStatusRequest ¶
type UpdateDisruptionStatusRequest struct {
Metadata core.Metadata
DisruptionID string
Status DisruptionStatus
}
type UpdateResponse ¶
type UpdateResponse struct {
Record NodeRecord
}
UpdateResponse represents the response after updating the state of a Node.
type UpdateStatusRequest ¶
type UpdateStatusRequest struct {
Metadata core.Metadata
Status NodeStatus
ClusterID string
}
UpdateStatusRequest represents the request to update the state and message of a Node.