Documentation
¶
Overview ¶
Copyright 2024, Nunet Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func EnsembleIDFromBehavior(b string) (string, error)
- type Allocation
- func (a *Allocation) Cleanup() error
- func (a *Allocation) ExecutionID() string
- func (a *Allocation) GetPortMapping() map[int]int
- func (a *Allocation) Restart(ctx context.Context) error
- func (a *Allocation) Run(ctx context.Context, subnetIP string, gatewayIP string, ...) error
- func (a *Allocation) SetHealthCheck(f func() error)
- func (a *Allocation) Start() error
- func (a *Allocation) Status(_ context.Context) Status
- func (a *Allocation) Stop(ctx context.Context) error
- func (a *Allocation) Terminate(ctx context.Context) error
- type AllocationDeploymentConfig
- type AllocationDeploymentRequest
- type AllocationDeploymentResponse
- type AllocationDetails
- type AllocationExecutor
- type AllocationLogsRequest
- type AllocationLogsResponse
- type AllocationManifest
- type AllocationRestartResponse
- type AllocationShutdownRequest
- type AllocationShutdownResponse
- type AllocationStartRequest
- type AllocationStartResponse
- type AllocationStatus
- type AllocationStopRequest
- type AllocationStopResponse
- type Bid
- type BidRequest
- type CommitDeploymentRequest
- type CommitDeploymentResponse
- type Coordinate
- type DeploymentSnapshot
- type DeploymentStatus
- type EdgeConstraint
- type EnsembleBidRequest
- type EnsembleConfig
- type EnsembleManifest
- type GeoLocator
- type HealthCheckResponse
- type Job
- type Location
- type LocationConstraints
- type NodeConfig
- type NodeManifest
- type Orchestrator
- func (o *Orchestrator) ActorPrivateKey() crypto.PrivKey
- func (o *Orchestrator) Config() EnsembleConfig
- func (o *Orchestrator) Deploy(expiry time.Time) error
- func (o *Orchestrator) DeploymentSnapshot() DeploymentSnapshot
- func (o *Orchestrator) GetAllocationLogs(name string) (AllocationLogsResponse, error)
- func (o *Orchestrator) ID() string
- func (o *Orchestrator) Manifest() EnsembleManifest
- func (o *Orchestrator) Shutdown()
- func (o *Orchestrator) Status() DeploymentStatus
- func (o *Orchestrator) Stop()
- type OrchestratorView
- type RegisterHealthcheckRequest
- type RegisterHealthcheckResponse
- type RevertDeploymentMessage
- type Status
- type SubnetAcceptPeerRequest
- type SubnetAcceptPeerResponse
- type SubnetAddPeerRequest
- type SubnetAddPeerResponse
- type SubnetCreateRequest
- type SubnetCreateResponse
- type SubnetDNSAddRecordsRequest
- type SubnetDNSAddRecordsResponse
- type SubnetDNSRemoveRecordRequest
- type SubnetDNSRemoveRecordResponse
- type SubnetDestroyRequest
- type SubnetDestroyResponse
- type SubnetMapPortRequest
- type SubnetMapPortResponse
- type SubnetRemovePeerRequest
- type SubnetRemovePeerResponse
- type SubnetUnmapPortRequest
- type SubnetUnmapPortResponse
- type VerifyEdgeConstraintRequest
- type VerifyEdgeConstraintResponse
Constants ¶
const ( EnsembleNamespace = "/dms/ensemble/%s" AllocationNamespace = "/dms/allocation" NodeNamespace = "/dms/node" )
const ( BidRequestTopic = "/nunet/deployment" BidRequestBehavior = "/dms/deployment/request" BidRequestTimeout = 5 * time.Second BidReplyBehavior = "/dms/deployment/bid" VerifyEdgeConstraintBehavior = "/dms/deployment/constraint/edge" VerifyEdgeConstraintTimeout = 5 * time.Second CommitDeploymentBehavior = "/dms/deployment/commit" CommitDeploymentTimeout = 3 * time.Second AllocationDeploymentBehavior = "/dms/deployment/allocate" AllocationDeploymentTimeout = 5 * time.Second RevertDeploymentBehavior = "/dms/deployment/revert" AllocationStartBehavior = "/dms/allocation/start" AllocationRestartBehavior = "/dms/allocation/restart" AllocationStartTimeout = 5 * time.Second AllocationShutdownTimeout = 5 * time.Second MinEnsembleDeploymentTime = 15 * time.Second MaxBidMultiplier = 8 SubnetCreateTimeout = 2 * time.Minute SubnetDestroyTimeout = 30 * time.Second )
const ( DeploymentStatusPreparing = job_types.DeploymentStatusPreparing DeploymentStatusGenerating = job_types.DeploymentStatusGenerating DeploymentStatusCommitting = job_types.DeploymentStatusCommitting DeploymentStatusProvisioning = job_types.DeploymentStatusProvisioning DeploymentStatusRunning = job_types.DeploymentStatusRunning DeploymentStatusFailed = job_types.DeploymentStatusFailed DeploymentStatusShuttingDown = job_types.DeploymentStatusShuttingDown DeploymentStatusCompleted = job_types.DeploymentStatusCompleted )
const MaxPermutations = 1_000_000
Variables ¶
var ( SubnetCreateBehavior = types.Behavior{ DynamicTemplate: EnsembleNamespace + "/node/subnet/create", Static: NodeNamespace + "/subnet/create", } SubnetDestroyBehavior = types.Behavior{ DynamicTemplate: EnsembleNamespace + "/node/subnet/destroy", Static: NodeNamespace + "/subnet/destroy", } RegisterHealthcheckBehavior = "/dms/actor/healthcheck/register" SubnetAddPeerBehavior = AllocationNamespace + "/subnet/add-peer" SubnetRemovePeerBehavior = AllocationNamespace + "/subnet/remove-peer" SubnetAcceptPeerBehavior = AllocationNamespace + "/subnet/accept-peer" SubnetMapPortBehavior = AllocationNamespace + "/subnet/map-port" SubnetUnmapPortBehavior = AllocationNamespace + "/subnet/unmap-port" SubnetDNSAddRecordsBehavior = AllocationNamespace + "/subnet/dns/add-records" SubnetDNSRemoveRecordBehavior = AllocationNamespace + "/subnet/dns/remove-record" AllocationLogsBehavior = EnsembleNamespace + "/allocation/logs" AllocationShutdownBehavior = EnsembleNamespace + "/allocation/shutdown" )
Functions ¶
func EnsembleIDFromBehavior ¶
Types ¶
type Allocation ¶
type Allocation struct { ID string Actor actor.Actor Job Job // contains filtered or unexported fields }
Allocation represents an allocation
func NewAllocation ¶
func NewAllocation( id string, fs afero.Afero, dmsConfig config.Config, actor actor.Actor, details AllocationDetails, network network.Network, ) (*Allocation, error)
NewAllocation creates a new allocation given the actor.
func (*Allocation) Cleanup ¶
func (a *Allocation) Cleanup() error
func (*Allocation) ExecutionID ¶
func (a *Allocation) ExecutionID() string
func (*Allocation) GetPortMapping ¶
func (a *Allocation) GetPortMapping() map[int]int
GetPortMapping returns allocation's port mapping
func (*Allocation) Run ¶
func (a *Allocation) Run(ctx context.Context, subnetIP string, gatewayIP string, portMapping map[int]int) error
Run creates the executor based on th e execution engine configuration.
func (*Allocation) SetHealthCheck ¶
func (a *Allocation) SetHealthCheck(f func() error)
func (*Allocation) Status ¶
func (a *Allocation) Status(_ context.Context) Status
Status returns information about the allocated/usage of resources and execution status of workload.
type AllocationDeploymentConfig ¶
type AllocationDeploymentConfig struct { Executor AllocationExecutor Resources types.Resources Execution types.SpecConfig ProvisionScripts map[string][]byte }
type AllocationDeploymentRequest ¶
type AllocationDeploymentRequest struct { EnsembleID string NodeID string Allocations map[string]AllocationDeploymentConfig }
type AllocationDetails ¶
AllocationDetails encapsulates the dependencies to the constructor.
type AllocationExecutor ¶
type AllocationExecutor = job_types.AllocationExecutor
type AllocationLogsRequest ¶
type AllocationLogsRequest struct {
AllocName string
}
type AllocationLogsResponse ¶
type AllocationManifest ¶
type AllocationManifest = job_types.AllocationManifest
type AllocationShutdownRequest ¶
type AllocationShutdownRequest struct {
AllocationID string
}
type AllocationStartRequest ¶
type AllocationStartResponse ¶
type AllocationStatus ¶
type AllocationStatus string
AllocationStatus is a representation of the execution status
const ( Pending AllocationStatus = "pending" Running AllocationStatus = "running" Stopped AllocationStatus = "stopped" Failed AllocationStatus = "failed" Completed AllocationStatus = "completed" Terminated AllocationStatus = "terminated" )
type AllocationStopRequest ¶
type AllocationStopRequest struct {
AllocationID string
}
type AllocationStopResponse ¶
type BidRequest ¶
type BidRequest = job_types.BidRequest
type CommitDeploymentRequest ¶
type Coordinate ¶
type Coordinate struct {
// contains filtered or unexported fields
}
func (*Coordinate) Empty ¶
func (c *Coordinate) Empty() bool
type DeploymentSnapshot ¶
type DeploymentSnapshot = job_types.DeploymentSnapshot
type DeploymentStatus ¶
type DeploymentStatus = job_types.DeploymentStatus
type EdgeConstraint ¶
type EdgeConstraint = job_types.EdgeConstraint
type EnsembleBidRequest ¶
type EnsembleBidRequest = job_types.EnsembleBidRequest
type EnsembleConfig ¶
type EnsembleConfig = job_types.EnsembleConfig
type EnsembleManifest ¶
type EnsembleManifest = job_types.EnsembleManifest
type GeoLocator ¶
type GeoLocator struct {
// contains filtered or unexported fields
}
func NewGeoLocator ¶
func NewGeoLocator() (*GeoLocator, error)
func (*GeoLocator) Coordinate ¶
func (geo *GeoLocator) Coordinate(loc Location) (Coordinate, error)
type HealthCheckResponse ¶
type LocationConstraints ¶
type LocationConstraints = job_types.LocationConstraints
type NodeConfig ¶
type NodeConfig = job_types.NodeConfig
type NodeManifest ¶
type NodeManifest = job_types.NodeManifest
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
func NewOrchestrator ¶
func NewOrchestrator( ctx context.Context, id string, actor actor.Actor, network network.Network, cfg EnsembleConfig, ) (*Orchestrator, error)
func RestoreDeployment ¶
func RestoreDeployment( actr actor.Actor, net network.Network, id string, cfg EnsembleConfig, manifest EnsembleManifest, status DeploymentStatus, restoreInfo DeploymentSnapshot, ) (*Orchestrator, error)
Restore restores deployments where the status is either provisioning, committing or running
func (*Orchestrator) ActorPrivateKey ¶
func (o *Orchestrator) ActorPrivateKey() crypto.PrivKey
func (*Orchestrator) Config ¶
func (o *Orchestrator) Config() EnsembleConfig
func (*Orchestrator) DeploymentSnapshot ¶
func (o *Orchestrator) DeploymentSnapshot() DeploymentSnapshot
func (*Orchestrator) GetAllocationLogs ¶
func (o *Orchestrator) GetAllocationLogs(name string) (AllocationLogsResponse, error)
func (*Orchestrator) ID ¶
func (o *Orchestrator) ID() string
func (*Orchestrator) Manifest ¶
func (o *Orchestrator) Manifest() EnsembleManifest
func (*Orchestrator) Shutdown ¶
func (o *Orchestrator) Shutdown()
func (*Orchestrator) Status ¶
func (o *Orchestrator) Status() DeploymentStatus
func (*Orchestrator) Stop ¶
func (o *Orchestrator) Stop()
type OrchestratorView ¶
type OrchestratorView = job_types.OrchestratorView
type RegisterHealthcheckRequest ¶
type RegisterHealthcheckRequest struct { EnsembleID string HealthCheck types.HealthCheckManifest }
type RevertDeploymentMessage ¶
type Status ¶
type Status struct { JobResources types.Resources Status AllocationStatus }
Status holds the status of an allocation.
type SubnetAcceptPeerRequest ¶
type SubnetAddPeerRequest ¶
type SubnetAddPeerResponse ¶
type SubnetCreateRequest ¶
type SubnetCreateResponse ¶
type SubnetDestroyRequest ¶
type SubnetDestroyRequest struct {
SubnetID string
}