Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type Dataset
- type Project
- func (p *Project) AddRequest(request *Request)
- func (p *Project) GetLastestTaskMsg() (string, string)
- func (p *Project) MarshalBinary() ([]byte, error)
- func (p *Project) RequestBootEnclave(request *Request, task helpers.TaskI, conf *Config)
- func (p *Project) RequestCreateProjectInstance(datasetIDs []string, conf *Config) (*Request, helpers.TaskI)
- func (p *Project) RequestDeleteEnclave(conf *Config)
- func (p *Project) RequestUnlockEnclave(conf *Config)
- func (p *Project) RequestUpdateAttributes(values url.Values, conf *Config)
- func (p *Project) UnmarshalBinary(data []byte) error
- func (p *Project) UpdateProjectcStatus(conf *Config, status string) error
- type ProjectSorter
- type ProjectStatus
- type Request
- type RequestSorter
- type RequestStatus
- type TOMLConfig
Constants ¶
const ( // ProjectStatusInit indicates that the project was created but with nothing // more ProjectStatusInit = "initialized" // ProjectStatusPreparingEnclave indicates that a request to boot the enclave // has been sent ProjectStatusPreparingEnclave = "preparingEnclave" // ProjectStatusPreparingEnclaveErrored indicates that a request to boot the // enclave has been sent and that is errored ProjectStatusPreparingEnclaveErrored = "preparingEnclaveErrored" // ProjectStatusPreparingEnclaveDone indicates that a request to boot the // enclave has been sent and that it terminated well ProjectStatusPreparingEnclaveDone = "preparingEnclaveDone" // ProjectStatusUpdatingAttributes indicates that a request to update the // attributes has been submitted ProjectStatusUpdatingAttributes = "updatingAttributes" // ProjectStatusAttributesUpdatedDone indicated the attributes have been updated ProjectStatusAttributesUpdatedDone = "attributesUpdated" // ProjectStatusAttributesUpdatedErrored indicates an error occured while // updating the attributes. ProjectStatusAttributesUpdatedErrored = "attributesUpdatedErrored" // ProjectStatusUnlockingEnclave indicates that a request to unlock the // enclave has been submitted ProjectStatusUnlockingEnclave = "unlockingEnclave" // ProjectStatusUnlockingEnclaveDone indicates that a request to unlock the // enclave has been submitted and is done ProjectStatusUnlockingEnclaveDone = "unlockingEnclaveDone" // ProjectStatusUnlockingEnclaveErrored indicates that a request to unlock the // enclave has been submitted and errored ProjectStatusUnlockingEnclaveErrored = "unlockingEnclaveErrored" // ProjectStatusDeletingEnclave indicate that we are trying to delete the // enclave ProjectStatusDeletingEnclave = "deletingEnclave" // ProjectStatusDeletingEnclaveDone indicate that the enclave was // successfully deleted ProjectStatusDeletingEnclaveDone = "deletingEnclaveDone" // ProjectStatusDeletingEnclaveErrored indicate that we failed to delete the // enclave ProjectStatusDeletingEnclaveErrored = "deletingEnclaveErrored" // RequestStatusRunning indicates the request is running RequestStatusRunning = "requestRunning" // RequestStatusErrored indicates the request stopped with an error RequestStatusErrored = "requestErrored" // RequestStatusDone indicates the request ended well RequestStatusDone = "requestDone" )
Variables ¶
var ProjectList = make(map[string]*Project)
ProjectList holds all the project created
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { *TOMLConfig TaskManager helpers.TaskManagerI Executor helpers.Executor CloudClient helpers.CloudClient RunHTTP helpers.RunHTTP }
Config holds the global configuration of the server
type Dataset ¶
type Dataset struct { Title string Description string Author string WriteInstID string CloudURL string SHA2 string }
Dataset contains the public informations of a dataset. This should match exactly what is stored as json in the extra data field of a write instance, as this struct is used to directly decode the json content.
type Project ¶
type Project struct { Status ProjectStatus // Uniq ID. Also servers as the enclave name and cloud endpoint. UID string Title string Description string InstanceID string Requests []*Request StatusNotifier *helpers.StatusNotifier CreatedAt time.Time PubKey string }
Project holds a project request
func NewProject ¶
NewProject creates an empty project. If the title is empty (""), will use a random generated title.
func (*Project) AddRequest ¶
AddRequest adds a new request to the project by prepending the request to the list of existing requests.
func (*Project) GetLastestTaskMsg ¶
GetLastestTaskMsg return the latest task message, or an empty one if there isn't any. This is convenient to check if the last message was an error and display an output to the client, for example the reasons why the enclave can't be unlocked.
func (*Project) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler
func (*Project) RequestBootEnclave ¶
RequestBootEnclave talks to the enclave manager and asks it to boot an enclave.
func (*Project) RequestCreateProjectInstance ¶
func (p *Project) RequestCreateProjectInstance(datasetIDs []string, conf *Config) (*Request, helpers.TaskI)
RequestCreateProjectInstance creates and runs a request that creates a new instance of a project contract.
func (*Project) RequestDeleteEnclave ¶
RequestDeleteEnclave talks to the enclave manager and asks it to delete an enclave.
func (*Project) RequestUnlockEnclave ¶
RequestUnlockEnclave talks to the enclave manager and asks it to boot an enclave.
func (*Project) RequestUpdateAttributes ¶
RequestUpdateAttributes creates a new request to update the attributes
func (*Project) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler
type ProjectSorter ¶
type ProjectSorter []*Project
ProjectSorter is used to define a sorter that sorts projects by the CreatedAt field.
func (ProjectSorter) Less ¶
func (p ProjectSorter) Less(i, j int) bool
Less compares two projects based on their CreatedAt fields
type Request ¶
type Request struct { Description string Status RequestStatus Tasks []helpers.TaskI StatusNotifier *helpers.StatusNotifier Index int }
Request holds a request for a project
func (*Request) GetCloudAttributes ¶
GetCloudAttributes return the alias, bucket name and prefix
func (*Request) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler
func (*Request) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler
type RequestSorter ¶
type RequestSorter []*Request
RequestSorter is used to define a sorter that sorts requests by the Index field.
func (RequestSorter) Less ¶
func (p RequestSorter) Less(i, j int) bool
Less compares two projects based on their CreatedAt fields