Documentation
¶
Overview ¶
Package data holds the SCP data-registration entities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataProduct ¶
type DataProduct struct {
ID string `gorm:"column:data_id;primaryKey;type:varchar(36)" json:"dataId"`
DataName *string `gorm:"column:data_name;type:varchar(255)" json:"dataName,omitempty"`
DataDescription *string `gorm:"column:data_description;type:varchar(2048)" json:"dataDescription,omitempty"`
IsFile bool `gorm:"column:is_file;not null" json:"isFile"`
Path *string `gorm:"column:path;type:varchar(2048)" json:"path,omitempty"`
ProvisionStatus *ProvisionStatus `gorm:"column:provision_status;type:varchar(32)" json:"provisionStatus,omitempty"`
OwnerID *string `gorm:"column:user_id;type:varchar(255);index" json:"ownerId,omitempty"`
Owner *iammodel.User `gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" json:"-"`
DataStorageID *string `gorm:"column:data_storage_id;type:varchar(36);index" json:"dataStorageId,omitempty"`
DataStorageType DataStorageType `gorm:"column:data_storage_type;type:varchar(32)" json:"dataStorageType,omitempty"`
CreatedAt int64 `gorm:"column:created_at;not null" json:"createdAt"`
}
func (*DataProduct) BeforeCreate ¶
func (p *DataProduct) BeforeCreate(*gorm.DB) error
BeforeCreate assigns a UUID when none was supplied.
func (*DataProduct) OwnedBy ¶
func (p *DataProduct) OwnedBy(userID string) bool
OwnedBy reports whether userID owns this product. A product with no owner is owned by nobody, so it must not match the empty principal name.
func (DataProduct) TableName ¶
func (DataProduct) TableName() string
TableName returns the table backing DataProduct.
type DataStorageType ¶
type DataStorageType string
const ( DataStorageTypeSCP DataStorageType = "SCP" DataStorageTypeHPC DataStorageType = "HPC" )
func (DataStorageType) Valid ¶
func (t DataStorageType) Valid() bool
type ProvisionStatus ¶
type ProvisionStatus string
ProvisionStatus is the lifecycle state of a registered dataset.
const ( ProvisionStatusRegistered ProvisionStatus = "REGISTERD" ProvisionStatusProvisioning ProvisionStatus = "PROVISIONING" ProvisionStatusProvisioned ProvisionStatus = "PROVISIONED" ProvisionStatusDeprovisioning ProvisionStatus = "DEPROVISIONING" ProvisionStatusDeprovisioned ProvisionStatus = "DEPROVISIONED" ProvisionStatusFailed ProvisionStatus = "FAILED" )
func (ProvisionStatus) Valid ¶
func (s ProvisionStatus) Valid() bool
Valid reports whether s is a recognised ProvisionStatus.
type SCPDataStorage ¶
type SCPDataStorage struct {
ID string `gorm:"column:data_id;primaryKey;type:varchar(36)" json:"dataId"`
Name *string `gorm:"column:data_name;type:varchar(255)" json:"dataName,omitempty"`
HostName *string `gorm:"column:host_name;type:varchar(255)" json:"hostName,omitempty"`
Port *int `gorm:"column:port;type:int" json:"port,omitempty"`
LoginUser *string `gorm:"column:login_user;type:varchar(255)" json:"loginUser,omitempty"`
SSHCredentialID *string `gorm:"column:ssh_credential_id;type:varchar(36);index" json:"sshCredentialId,omitempty"`
SSHCredential *cred.SSHCredential `gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" json:"sshCredential,omitempty"`
// OwnerID is named for its role because ownership, not mere reference, is what the
// authorisation checks read. RESTRICT: a user who still owns storages cannot be
// deleted out from under them.
OwnerID *string `gorm:"column:user_id;type:varchar(255);index" json:"ownerId,omitempty"`
Owner *iammodel.User `gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" json:"-"`
}
SCPDataStorage is a host and account data products can be staged through.
It names the host itself — the name and port to reach over SSH — and the account it is reached as: a login user and the key presented for it. The host and the account are spelled out here rather than pointed at catalogue entries, for the same reason a SlurmClusterConfig spells them out: a storage is self-service, and a catalogue only an admin can add to would mean asking an admin before registering one. Only the key stays a reference, because the private material has to live somewhere it is never read back.
It belongs to whoever registered it, and everyone else reaches it through the sharing rows below. Ownership is not transferable through the API: products are registered against a storage by id, so handing one over would silently hand over the place every dataset on it lives.
func (*SCPDataStorage) BeforeCreate ¶
func (s *SCPDataStorage) BeforeCreate(*gorm.DB) error
BeforeCreate assigns a UUID when none was supplied.
func (*SCPDataStorage) OwnedBy ¶
func (s *SCPDataStorage) OwnedBy(userID string) bool
OwnedBy reports whether userID owns this storage. A storage with no owner is owned by nobody, so it must not match the empty principal name.
func (SCPDataStorage) TableName ¶
func (SCPDataStorage) TableName() string
TableName returns the table backing SCPDataStorage.
type VirtualDataDirectory ¶
type VirtualDataDirectory struct {
ID string `gorm:"column:virtual_data_directory_id;primaryKey;type:varchar(36)" json:"virtualDataDirectoryId"`
// Unique among the entries of one parent, for the reason given on FileName.
DirectoryName *string `gorm:"column:directory_name;type:varchar(255);uniqueIndex:uk_virtual_data_directory_name" json:"directoryName,omitempty"`
// A nil parent is a root: the top of one virtual dataset.
ParentDirectoryID *string `` /* 134-byte string literal not displayed */
Files []VirtualDataFile `` /* 128-byte string literal not displayed */
Directories []VirtualDataDirectory `` /* 134-byte string literal not displayed */
// Set only on a directory that stands for a registered directory product. RESTRICT
// for the same reason as on a file: a cited product cannot be deleted.
DataProductID *string `gorm:"column:data_product_id;type:varchar(36);index" json:"dataProductId,omitempty"`
DataProduct *DataProduct `gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" json:"dataProduct,omitempty"`
OwnerID *string `gorm:"column:user_id;type:varchar(255);index" json:"ownerId,omitempty"`
Owner *iammodel.User `gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" json:"-"`
CreatedAt int64 `gorm:"column:created_at;not null" json:"createdAt"`
}
VirtualDirectory holds different types of virtual directories and virtual files. If there is a DataProductID, the directory represents a registered product and should not have children.
func (*VirtualDataDirectory) BeforeCreate ¶
func (d *VirtualDataDirectory) BeforeCreate(*gorm.DB) error
func (*VirtualDataDirectory) BeforeSave ¶
func (d *VirtualDataDirectory) BeforeSave(*gorm.DB) error
func (VirtualDataDirectory) TableName ¶
func (VirtualDataDirectory) TableName() string
type VirtualDataFile ¶
type VirtualDataFile struct {
ID string `gorm:"column:virtual_data_file_id;primaryKey;type:varchar(36)" json:"virtualDataFileId"`
FileName *string `gorm:"column:file_name;type:varchar(255);uniqueIndex:uk_virtual_data_file_name" json:"fileName,omitempty"`
ParentDirectoryID *string `` /* 129-byte string literal not displayed */
DataProductID *string `gorm:"column:data_product_id;type:varchar(36);index" json:"dataProductId,omitempty"`
DataProduct *DataProduct `gorm:"references:ID;constraint:OnDelete:RESTRICT,OnUpdate:CASCADE" json:"dataProduct,omitempty"`
CreatedAt int64 `gorm:"column:created_at;not null" json:"createdAt"`
}
func (*VirtualDataFile) BeforeCreate ¶
func (f *VirtualDataFile) BeforeCreate(*gorm.DB) error
func (*VirtualDataFile) BeforeSave ¶
func (f *VirtualDataFile) BeforeSave(*gorm.DB) error
func (VirtualDataFile) TableName ¶
func (VirtualDataFile) TableName() string