Changed the InMemory bool to a uint32 so that it can be used to alter how much space to reserve

This commit is contained in:
Tom Maxwell
2019-09-04 15:27:14 +01:00
parent 6ee65356e3
commit 4a878c0006
20 changed files with 111 additions and 67 deletions

View File

@@ -139,7 +139,7 @@ message AssignRequest {
string data_center = 5;
string rack = 6;
string data_node = 7;
bool in_memory = 8;
uint32 MemoryMapMaxSizeMB = 8;
}
message AssignResponse {
string fid = 1;

View File

@@ -651,14 +651,14 @@ func (m *Location) GetPublicUrl() string {
}
type AssignRequest struct {
Count uint64 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"`
Replication string `protobuf:"bytes,2,opt,name=replication" json:"replication,omitempty"`
Collection string `protobuf:"bytes,3,opt,name=collection" json:"collection,omitempty"`
Ttl string `protobuf:"bytes,4,opt,name=ttl" json:"ttl,omitempty"`
DataCenter string `protobuf:"bytes,5,opt,name=data_center,json=dataCenter" json:"data_center,omitempty"`
Rack string `protobuf:"bytes,6,opt,name=rack" json:"rack,omitempty"`
DataNode string `protobuf:"bytes,7,opt,name=data_node,json=dataNode" json:"data_node,omitempty"`
InMemory bool `protobuf:"bytes,4,opt,name=inmemory" json:"inmemory,omitempty"`
Count uint64 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"`
Replication string `protobuf:"bytes,2,opt,name=replication" json:"replication,omitempty"`
Collection string `protobuf:"bytes,3,opt,name=collection" json:"collection,omitempty"`
Ttl string `protobuf:"bytes,4,opt,name=ttl" json:"ttl,omitempty"`
DataCenter string `protobuf:"bytes,5,opt,name=data_center,json=dataCenter" json:"data_center,omitempty"`
Rack string `protobuf:"bytes,6,opt,name=rack" json:"rack,omitempty"`
DataNode string `protobuf:"bytes,7,opt,name=data_node,json=dataNode" json:"data_node,omitempty"`
MemoryMapMaxSizeMB uint32 `protobuf:"varint,8,opt,name=memorymapmaxsizemb" json:"memorymapmaxsizemb,omitempty"`
}
func (m *AssignRequest) Reset() { *m = AssignRequest{} }
@@ -715,11 +715,11 @@ func (m *AssignRequest) GetDataNode() string {
return ""
}
func (m *AssignRequest) GetInMemory() bool {
func (m *AssignRequest) GetMemoryMapMaxSizeMB() uint32 {
if m != nil {
return m.InMemory
return m.MemoryMapMaxSizeMB
}
return false
return 0
}
type AssignResponse struct {

View File

@@ -127,7 +127,7 @@ message AllocateVolumeRequest {
int64 preallocate = 3;
string replication = 4;
string ttl = 5;
bool inmemory = 6;
int32 memorymapmaxsizemb = 6;
}
message AllocateVolumeResponse {
}

View File

@@ -316,12 +316,12 @@ func (*DeleteCollectionResponse) ProtoMessage() {}
func (*DeleteCollectionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
type AllocateVolumeRequest struct {
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
Collection string `protobuf:"bytes,2,opt,name=collection" json:"collection,omitempty"`
Preallocate int64 `protobuf:"varint,3,opt,name=preallocate" json:"preallocate,omitempty"`
Replication string `protobuf:"bytes,4,opt,name=replication" json:"replication,omitempty"`
Ttl string `protobuf:"bytes,5,opt,name=ttl" json:"ttl,omitempty"`
InMemory bool `protobuf:"varint,6,opt,name=inmemory" json:"inmemory,omitempty"`
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
Collection string `protobuf:"bytes,2,opt,name=collection" json:"collection,omitempty"`
Preallocate int64 `protobuf:"varint,3,opt,name=preallocate" json:"preallocate,omitempty"`
Replication string `protobuf:"bytes,4,opt,name=replication" json:"replication,omitempty"`
Ttl string `protobuf:"bytes,5,opt,name=ttl" json:"ttl,omitempty"`
MemoryMapMaxSizeMB uint32 `protobuf:"varint,6,opt,name=memorymapmaxsizemb" json:"memorymapmaxsizemb,omitempty"`
}
func (m *AllocateVolumeRequest) Reset() { *m = AllocateVolumeRequest{} }
@@ -364,11 +364,11 @@ func (m *AllocateVolumeRequest) GetTtl() string {
return ""
}
func (m *AllocateVolumeRequest) GetInMemory() bool {
func (m *AllocateVolumeRequest) GetMemoryMapMaxSizeMB() uint32 {
if m != nil {
return m.InMemory
return m.MemoryMapMaxSizeMB
}
return false
return 0
}
type AllocateVolumeResponse struct {
@@ -1978,6 +1978,19 @@ func _VolumeServer_DeleteCollection_Handler(srv interface{}, ctx context.Context
func _VolumeServer_AllocateVolume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AllocateVolumeRequest)
if in.MemoryMapMaxSizeMB > 0 {
test := 6
test += 5
}
if in.MemoryMapMaxSizeMB == 77 {
test := 7
test += 656
}
if in.Ttl != "" {
test := 2345
test += 567
}
if err := dec(in); err != nil {
return nil, err
}