organize + graph
This commit is contained in:
39
models/resources/storage/storage.go
Normal file
39
models/resources/storage/storage.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
resources "oc-lib/models/resources"
|
||||
"oc-lib/models/utils"
|
||||
)
|
||||
|
||||
type URL struct {
|
||||
Protocol string `bson:"protocol" json:"protocol"`
|
||||
Path string `bson:"path" json:"path"`
|
||||
}
|
||||
|
||||
type Storage struct {
|
||||
resources.AbstractResource
|
||||
|
||||
Capacity uint `bson:"capacity,omitempty" json:"capacity,omitempty"`
|
||||
Url URL `bson:"url,omitempty" json:"url,omitempty"` // Will allow to select between several protocols
|
||||
|
||||
Encryption bool `bson:"encryption,omitempty" json:"encryption,omitempty"`
|
||||
Redundancy string `bson:"redundancy,omitempty" json:"redundancy,omitempty"`
|
||||
Throughput string `bson:"throughput,omitempty" json:"throughput,omitempty"`
|
||||
BookingPrice uint `bson:"booking_price,omitempty" json:"booking_price,omitempty"`
|
||||
}
|
||||
|
||||
func (s *Storage) GetType() resources.ResourceType {
|
||||
return resources.STORAGE
|
||||
}
|
||||
|
||||
func (d *Storage) GetAccessor(driver utils.Driver) utils.Accessor {
|
||||
var data utils.Accessor
|
||||
switch driver {
|
||||
case utils.MONGO:
|
||||
data = &StorageMongoAccessor{}
|
||||
default:
|
||||
data = &StorageMongoAccessor{}
|
||||
}
|
||||
data.SetLogger()
|
||||
return data
|
||||
}
|
||||
Reference in New Issue
Block a user