Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTrustContextFromKeyStore(afs afero.Afero, contextKey string, cfg *config.Config) (did.TrustContext, crypto.PrivKey, error)
- func IsLedgerContext(context string) bool
- func LedgerContext(context string) string
- func LoadCapabilityContext(trustCtx did.TrustContext, name string, cfg *config.Config) (ucan.CapabilityContext, error)
- func SaveCapabilityContext(capCtx ucan.CapabilityContext, cfg *config.Config) error
- type CapAnchorRequest
- type CapAnchorResponse
- type CapListRequest
- type CapListResponse
- type CustomVMStartRequest
- type CustomVMStartResponse
- type DeploymentListResponse
- type DeploymentLogsRequest
- type DeploymentLogsResponse
- type DeploymentManifestRequest
- type DeploymentManifestResponse
- type DeploymentShutdownRequest
- type DeploymentShutdownResponse
- type DeploymentStatusRequest
- type DeploymentStatusResponse
- type HelloResponse
- type HostGeolocation
- type ListVMResponse
- type LoggerConfigRequest
- type LoggerConfigResponse
- type NewDeploymentRequest
- type NewDeploymentResponse
- type Node
- func (n *Node) ExecutorAvailable(execType jobs.AllocationExecutor) bool
- func (n *Node) GetAllocation(id string) (*jobs.Allocation, error)
- func (n *Node) GetAllocations() []*jobs.Allocation
- func (n *Node) GetBidRequests() []jobs.BidRequest
- func (n *Node) ResourceManager() types.ResourceManager
- func (n *Node) Start() error
- func (n *Node) Stop() error
- type OffboardRequest
- type OffboardResponse
- type OnboardRequest
- type OnboardResponse
- type OnboardStatusResponse
- type PeerAddrInfoResponse
- type PeerConnectRequest
- type PeerConnectResponse
- type PeerDHTResponse
- type PeerScoreResponse
- type PeersListResponse
- type PingRequest
- type PingResponse
- type PortAllocator
- func (pa *PortAllocator) AllocatePorts(allocationID string, ports []int) error
- func (pa *PortAllocator) AllocateRandom(allocationID string, numPorts int) ([]int, error)
- func (pa *PortAllocator) Allocated(ports []int) bool
- func (pa *PortAllocator) GetAllocation(allocationID string) ([]int, error)
- func (pa *PortAllocator) PortsAvailable(numPorts int) bool
- func (pa *PortAllocator) Release(allocationID string)
- type PortConfig
- type PublicStatusResponse
- type VMStopRequest
- type VMStopResponse
Constants ¶
const ( DefaultContextName = "dms" UserContextName = "user" KeystoreDir = "key/" CapstoreDir = "cap/" )
const ( NewDeploymentBehavior = "/dms/node/deployment/new" // Minimum time for deployment MinDeploymentTime = time.Minute - time.Second RestoreDeadlineCommitting = 1 * time.Minute RestoreDeadlineProvisioning = 1 * time.Minute RestoreDeadlineRunning = 5 * time.Minute )
const ( PeersListBehavior = "/dms/node/peers/list" PeerAddrInfoBehavior = "/dms/node/peers/self" PeerPingBehavior = "/dms/node/peers/ping" PeerDHTBehavior = "/dms/node/peers/dht" PeerConnectBehavior = "/dms/node/peers/connect" PeerScoreBehavior = "/dms/node/peers/score" OnboardBehavior = "/dms/node/onboarding/onboard" OffboardBehavior = "/dms/node/onboarding/offboard" OnboardStatusBehavior = "/dms/node/onboarding/status" ContainerStartBehavior = "/dms/node/container/start" ContainerStopBehavior = "/dms/node/container/stop" ContainerListBehavior = "/dms/node/container/list" VMStartBehavior = "/dms/node/vm/start/custom" VMStopBehavior = "/dms/node/vm/stop" VMListBehavior = "/dms/node/vm/list" DeploymentListBehavior = "/dms/node/deployment/list" DeploymentStatusBehavior = "/dms/node/deployment/status" DeploymentLogsBehavior = "/dms/node/deployment/logs" DeploymentManifestBehavior = "/dms/node/deployment/manifest" DeploymentShutdownBehavior = "/dms/node/deployment/shutdown" ResourcesAllocatedBehavior = "/dms/node/resources/allocated" ResourcesFreeBehavior = "/dms/node/resources/free" ResourcesOnboardedBehavior = "/dms/node/resources/onboarded" HardwareSpecBehavior = "/dms/node/hardware/spec" HardwareUsageBehavior = "/dms/node/hardware/usage" LoggerConfigBehavior = "/dms/node/logger/config" RestartAllocationBehavior = "/dms/node/allocation/restart" StopAllocationBehavior = "/dms/node/allocation/stop" CapListBehavior = "/dms/cap/list" CapAnchorBehavior = "/dms/cap/anchor" )
const ( PublicHelloBehavior = "/public/hello" PublicStatusBehavior = "/public/status" BroadcastHelloBehavior = "/broadcast/hello" BroadcastHelloTopic = "/nunet/hello" )
Variables ¶
Functions ¶
func IsLedgerContext ¶
func LedgerContext ¶
func LoadCapabilityContext ¶
func LoadCapabilityContext(trustCtx did.TrustContext, name string, cfg *config.Config) (ucan.CapabilityContext, error)
func SaveCapabilityContext ¶
func SaveCapabilityContext(capCtx ucan.CapabilityContext, cfg *config.Config) error
Types ¶
type CapAnchorRequest ¶
type CapAnchorResponse ¶
type CapListRequest ¶
type CapListRequest struct {
Context string
}
type CapListResponse ¶
type CustomVMStartRequest ¶
type CustomVMStartRequest struct {
Execution types.ExecutionRequest
}
type CustomVMStartResponse ¶
type CustomVMStartResponse struct {
Error string
}
type DeploymentListResponse ¶
type DeploymentLogsRequest ¶
type DeploymentLogsResponse ¶
type DeploymentManifestRequest ¶
type DeploymentManifestRequest struct {
ID string
}
type DeploymentManifestResponse ¶
type DeploymentManifestResponse struct { Manifest jobs.EnsembleManifest Error string }
type DeploymentShutdownRequest ¶
type DeploymentShutdownRequest struct {
ID string
}
type DeploymentStatusRequest ¶
type DeploymentStatusRequest struct {
ID string
}
type HelloResponse ¶
type HostGeolocation ¶
type ListVMResponse ¶
type ListVMResponse struct { Error string VMS []types.ExecutionListItem ExecutionType jobs.AllocationExecutor }
type LoggerConfigRequest ¶
type LoggerConfigResponse ¶
type NewDeploymentRequest ¶
type NewDeploymentRequest struct {
Ensemble job_types.EnsembleConfig
}
type NewDeploymentResponse ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is the structure that holds the node's dependencies.
func New ¶
func New(cfg config.Config, fs afero.Afero, onboarder *onboarding.Onboarding, rootCap ucan.CapabilityContext, hostID string, net network.Network, resourceManager types.ResourceManager, scheduler *bt.Scheduler, hardware types.HardwareManager, orchestratorRepo repositories.OrchestratorView, geoip types.GeoIPLocator, hostLocation HostGeolocation, portConfig PortConfig, contractRepo repositories.Contract, ) (*Node, error)
New creates a new node, attaches an actor to the node.
func (*Node) ExecutorAvailable ¶
func (n *Node) ExecutorAvailable(execType jobs.AllocationExecutor) bool
ExecutorAvailable returns the availability of a specific executor.
func (*Node) GetAllocation ¶
func (n *Node) GetAllocation(id string) (*jobs.Allocation, error)
GetAllocation gets an allocation by id.
func (*Node) GetAllocations ¶
func (n *Node) GetAllocations() []*jobs.Allocation
GetAllocations returns a list of allocations in the node.
func (*Node) GetBidRequests ¶
func (n *Node) GetBidRequests() []jobs.BidRequest
GetBidRequests returns the bid requests for the node.
func (*Node) ResourceManager ¶
func (n *Node) ResourceManager() types.ResourceManager
type OffboardRequest ¶
type OffboardRequest struct{}
type OffboardResponse ¶
type OnboardRequest ¶
type OnboardRequest struct { NoGPU bool GPUs string Config types.OnboardingConfig }
type OnboardResponse ¶
type OnboardResponse struct { Success bool `json:"success"` Error string `json:"error,omitempty"` Config types.OnboardingConfig `json:"config,omitempty"` }
type OnboardStatusResponse ¶
type PeerAddrInfoResponse ¶
type PeerConnectRequest ¶
type PeerConnectRequest struct {
Address string
}
type PeerConnectResponse ¶
type PeerDHTResponse ¶
type PeerScoreResponse ¶
type PeerScoreResponse struct {
Score map[string]*network.PeerScoreSnapshot
}
type PeersListResponse ¶
type PingRequest ¶
type PingRequest struct {
Host string
}
type PingResponse ¶
type PortAllocator ¶
type PortAllocator struct {
// contains filtered or unexported fields
}
PortAllocator keeps track of port allocations and manages state.
func NewPortAllocator ¶
func NewPortAllocator(config PortConfig) *PortAllocator
NewPortAllocator initializes a new PortAllocator with a PortConfig.
func (*PortAllocator) AllocatePorts ¶
func (pa *PortAllocator) AllocatePorts(allocationID string, ports []int) error
AllocatePorts allocates the requested ports, associating them with an allocation. If it's not possible to allocate one of the ports, an error is returned and no ports are allocated.
func (*PortAllocator) AllocateRandom ¶
func (pa *PortAllocator) AllocateRandom(allocationID string, numPorts int) ([]int, error)
AllocateRandom allocates the requested number of ports and associates them with the allocation ID.
func (*PortAllocator) Allocated ¶
func (pa *PortAllocator) Allocated(ports []int) bool
Allocated checks if the given ports are already allocated.
func (*PortAllocator) GetAllocation ¶
func (pa *PortAllocator) GetAllocation(allocationID string) ([]int, error)
GetAllocations returns the allocated ports for a specific allocation ID.
func (*PortAllocator) PortsAvailable ¶
func (pa *PortAllocator) PortsAvailable(numPorts int) bool
func (*PortAllocator) Release ¶
func (pa *PortAllocator) Release(allocationID string)
Release releases the ports associated with the allocation ID.
type PortConfig ¶
type PublicStatusResponse ¶
type VMStopRequest ¶
type VMStopRequest struct { ExecutionID string ExecutionType jobs.AllocationExecutor }
type VMStopResponse ¶
type VMStopResponse struct {
Error string
}