Documentation
¶
Index ¶
Constants ¶
const ( TermKeyHour = "hourly" TermKeyMonth = "monthly" TermKeyYear = "yearly" )
const SchedulerMetadataOfferKey = schedulerMetadataPrefix + "offer"
SchedulerMetadataOfferKey is the metadata key used for the offer name.
Variables ¶
var DefaultSchedulerApp = map[string]map[string]string{
"testnet": {
"sapphire": "rofl1qrqw99h0f7az3hwt2cl7yeew3wtz0fxunu7luyfg",
},
}
DefaultSchedulerApp contains the default scheduler app IDs for each network/paratime.
var ManifestFileNames = []string{
"rofl-provider.yaml",
"rofl-provider.yml",
}
ManifestFileNames are the manifest file names that are tried when loading the manifest.
Functions ¶
func ManifestExists ¶
func ManifestExists() bool
ManifestExists checks whether a manifest file exist. No attempt is made to load, parse or validate any of the found manifest files.
Types ¶
type GPUResource ¶
type GPUResource struct {
// Model is the optional GPU model.
Model string `yaml:"model,omitempty" json:"model,omitempty"`
// Count is the number of GPUs requested.
Count uint8 `yaml:"count" json:"count"`
}
GPUResource is the offered GPU resource.
func (*GPUResource) Validate ¶
func (g *GPUResource) Validate() error
Validate validates the GPU resource.
type Manifest ¶
type Manifest struct {
// Name is the optional name of the provider.
Name string `yaml:"name,omitempty" json:"name,omitempty"`
// Homepage is the optional homepage URL of the provider.
Homepage string `yaml:"homepage,omitempty" json:"homepage,omitempty"`
// Description is the optional description of the provider.
Description string `yaml:"description,omitempty" json:"description,omitempty"`
// Network is the identifier of the network to deploy to.
Network string `yaml:"network" json:"network"`
// ParaTime is the identifier of the paratime to deploy to.
ParaTime string `yaml:"paratime" json:"paratime"`
// Provider is the identifier of the provider account.
Provider string `yaml:"provider,omitempty" json:"provider,omitempty"`
// Nodes are the public keys of nodes authorized to act on behalf of provider.
Nodes []signature.PublicKey `yaml:"nodes" json:"nodes"`
// ScheduperApp is the authorized scheduper app for this provider.
SchedulerApp rofl.AppID `yaml:"scheduler_app" json:"scheduler_app"`
// PaymentAddress is the payment address.
PaymentAddress string `yaml:"payment_address" json:"payment_address"`
// Offers is a list of offers available from this provider.
Offers []*Offer `yaml:"offers,omitempty" json:"offers,omitempty"`
// Metadata is arbitrary metadata (key-value pairs) assigned by the provider.
Metadata map[string]string `yaml:"metadata,omitempty" json:"metadata,omitempty"`
// contains filtered or unexported fields
}
Manifest is the manifest describing a provider.
func LoadManifest ¶
LoadManifest attempts to find and load the ROFL app manifest from a local file.
func (*Manifest) GetMetadata ¶
GetMetadata derives metadata from the attributes defined in the manifest and combines it with the specified metadata.
func (*Manifest) Save ¶
Save serializes the manifest and writes it to the file returned by `SourceFileName`, overwriting any previous manifest.
If no previous source filename is available, a default one is set.
func (*Manifest) SourceFileName ¶
SourceFileName returns the filename of the manifest file from which the manifest was loaded or an empty string in case the filename is not available.
type Offer ¶
type Offer struct {
// ID is the unique offer identifier used by the scheduler.
ID string `yaml:"id" json:"id"`
// Resources are the offered resources.
Resources Resources `yaml:"resources" json:"resources"`
// Payment is the payment for this offer.
Payment Payment `yaml:"payment" json:"payment"`
// Capacity is the amount of available instances. Setting this to zero will disallow
// provisioning of new instances for this offer. Each accepted instance will automatically
// decrement capacity.
Capacity uint64 `yaml:"capacity" json:"capacity"`
// Metadata is arbitrary metadata (key-value pairs) assigned by the provider.
Metadata map[string]string `yaml:"metadata,omitempty" json:"metadata,omitempty"`
}
Offer is a provider's offer.
func (*Offer) AsDescriptor ¶
AsDescriptor returns the configuration as an on-chain descriptor.
func (*Offer) GetMetadata ¶
GetMetadata derives metadata from the attributes defined in the offer and combines it with the specified metadata.
type Payment ¶
type Payment struct {
Native *struct {
Denomination string `yaml:"denomination" json:"denomination"`
Terms map[string]string `yaml:"terms" json:"terms"`
} `yaml:"native,omitempty" json:"native,omitempty"`
EvmContract *struct {
Address string `json:"address"`
Data string `json:"data"`
} `yaml:"evm,omitempty" json:"evm,omitempty"`
}
Payment is payment configuration for an offer.
func (*Payment) AsDescriptor ¶
AsDescriptor returns the configuration as an on-chain descriptor.
type Resources ¶
type Resources struct {
// TEE is the type of TEE hardware.
TEE string `yaml:"tee" json:"tee"`
// Memory is the amount of memory in megabytes.
Memory uint64 `yaml:"memory" json:"memory"`
// CPUCount is the amount of vCPUs.
CPUCount uint16 `yaml:"cpus" json:"cpus"`
// Storage is the amount of storage ine megabytes.
Storage uint64 `yaml:"storage" json:"storage"`
// GPU is the optional GPU resource.
GPU *GPUResource `yaml:"gpu,omitempty" json:"gpu,omitempty"`
}
Resources are describe the offered resources.
func (*Resources) AsDescriptor ¶
func (r *Resources) AsDescriptor() *roflmarket.Resources
AsDescriptor returns the configuration as an on-chain descriptor.