-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathreservation.go
57 lines (45 loc) · 1.46 KB
/
reservation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package cluster
import (
dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3"
mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
atypes "github.com/akash-network/akash-api/go/node/types/v1beta3"
ctypes "github.com/akash-network/provider/cluster/types/v1beta3"
"github.com/akash-network/provider/cluster/util"
)
func newReservation(order mtypes.OrderID, resources dtypes.ResourceGroup) *reservation {
return &reservation{
order: order,
resources: resources,
endpointQuantity: util.GetEndpointQuantityOfResourceGroup(resources, atypes.Endpoint_LEASED_IP)}
}
type reservation struct {
order mtypes.OrderID
resources dtypes.ResourceGroup
adjustedResources dtypes.ResourceUnits
clusterParams interface{}
endpointQuantity uint
allocated bool
ipsConfirmed bool
}
var _ ctypes.Reservation = (*reservation)(nil)
func (r *reservation) OrderID() mtypes.OrderID {
return r.order
}
func (r *reservation) Resources() dtypes.ResourceGroup {
return r.resources
}
func (r *reservation) SetAllocatedResources(val dtypes.ResourceUnits) {
r.adjustedResources = val
}
func (r *reservation) GetAllocatedResources() dtypes.ResourceUnits {
return r.adjustedResources
}
func (r *reservation) SetClusterParams(val interface{}) {
r.clusterParams = val
}
func (r *reservation) ClusterParams() interface{} {
return r.clusterParams
}
func (r *reservation) Allocated() bool {
return r.allocated
}