Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateTotalPrice(order *pb.Order) *big.Int
- func ParseGPUCount(ty string) (pb.GPUCount, error)
- func ParseNetworkType(ty string) (pb.NetworkType, error)
- func ParseOrderType(ty string) (pb.OrderType, error)
- func RequireHeaderInt64(md metadata.MD, name string) (int64, error)
- func ValidateResources(resources *pb.Resources) error
- type DealRequest
- type ImagePush
- type Order
- type Resources
- type Slot
- type StartTaskRequest
- type TaskResources
Constants ¶
View Source
const (
MinSlotDuration = 10 * time.Minute
)
Variables ¶
View Source
var (
ErrDurationIsTooShort = errors.New("duration is too short")
)
View Source
var (
ErrUnsupportedSingleGPU = errors.New("unsupported gpu count, use MULTIPLE_GPU instead")
)
Functions ¶
func ParseNetworkType ¶
func ParseNetworkType(ty string) (pb.NetworkType, error)
func ValidateResources ¶
ValidateResources validates the specified protobuf object to be wrapped.
Types ¶
type DealRequest ¶
type DealRequest struct {
*sonm.DealRequest
}
func NewDealRequest ¶
func NewDealRequest(deal *sonm.DealRequest) (*DealRequest, error)
type ImagePush ¶
type ImagePush struct { sonm.Hub_PushTaskServer // contains filtered or unexported fields }
func NewImagePush ¶
type Order ¶
Order represents a safe order wrapper.
This is used to decompose the validation out of the protocol. All methods must return the valid sub-structures.
func (*Order) GetDuration ¶
func (*Order) GetTotalPrice ¶ added in v0.3.2
type Resources ¶
type Resources struct {
// contains filtered or unexported fields
}
Resources wraps the underlying protobuf object with full validation, such as checking all required fields exists etc.
func NewResources ¶
NewResources constructs a new resources wrapper using provided protobuf object.
func (*Resources) GetCpuCores ¶
GetCpuCores returns the total number of logical CPU cores.
func (*Resources) GetGPUCount ¶
GetGPUCount returns the number of GPU devices required.
func (*Resources) GetMemoryInBytes ¶
GetMemoryInBytes returns the total number of memory bytes requested.
type Slot ¶
type Slot struct {
// contains filtered or unexported fields
}
func (*Slot) Compare ¶
Compare compares two slots, returns true if "s" slot is fits into an "another" slot
func (*Slot) GetResources ¶
func (*Slot) MarshalJSON ¶
func (*Slot) UnmarshalJSON ¶
type StartTaskRequest ¶
type StartTaskRequest struct {
*sonm.HubStartTaskRequest
}
func NewStartTaskRequest ¶
func NewStartTaskRequest(request *sonm.HubStartTaskRequest) (*StartTaskRequest, error)
func (*StartTaskRequest) GetDeal ¶
func (r *StartTaskRequest) GetDeal() *sonm.Deal
func (*StartTaskRequest) GetDealId ¶
func (r *StartTaskRequest) GetDealId() string
type TaskResources ¶
type TaskResources struct {
// contains filtered or unexported fields
}
func NewTaskResources ¶
func NewTaskResources(r *pb.TaskResourceRequirements) (*TaskResources, error)
func (*TaskResources) RequiresGPU ¶
func (r *TaskResources) RequiresGPU() bool
func (*TaskResources) ToCgroupResources ¶
func (r *TaskResources) ToCgroupResources() *specs.LinuxResources
func (*TaskResources) ToContainerResources ¶
func (r *TaskResources) ToContainerResources(cgroupParent string) container.Resources
func (*TaskResources) ToUsage ¶
func (r *TaskResources) ToUsage() resource.Resources
Source Files ¶
Click to show internal directories.
Click to hide internal directories.