Browse Source
Changed the InMemory bool to a uint32 so that it can be used to alter how much space to reserve
pull/1087/head
Changed the InMemory bool to a uint32 so that it can be used to alter how much space to reserve
pull/1087/head
Tom Maxwell
5 years ago
20 changed files with 111 additions and 67 deletions
-
4weed/command/backup.go
-
2weed/command/compact.go
-
2weed/pb/master.proto
-
22weed/pb/master_pb/master.pb.go
-
2weed/pb/volume_server.proto
-
31weed/pb/volume_server_pb/volume_server.pb.go
-
15weed/server/master_grpc_server_volume.go
-
20weed/server/master_server_handlers_admin.go
-
2weed/server/volume_grpc_admin.go
-
2weed/storage/disk_location.go
-
14weed/storage/needle/volume_memory_map_max_size.go
-
10weed/storage/needle/volume_memory_map_max_size_test.go
-
4weed/storage/store.go
-
4weed/storage/volume.go
-
2weed/storage/volume_create.go
-
2weed/storage/volume_create_linux.go
-
6weed/storage/volume_create_windows.go
-
6weed/storage/volume_vacuum.go
-
12weed/topology/allocate_volume.go
-
16weed/topology/volume_growth.go
@ -0,0 +1,14 @@ |
|||||
|
package needle |
||||
|
|
||||
|
import "strconv" |
||||
|
|
||||
|
func ReadMemoryMapMaxSizeMB(MemoryMapMaxSizeMBString string) (uint32, error) { |
||||
|
if MemoryMapMaxSizeMBString == "" { |
||||
|
return 0, nil |
||||
|
} |
||||
|
var MemoryMapMaxSize64 uint64 |
||||
|
var err error |
||||
|
MemoryMapMaxSize64, err = strconv.ParseUint(MemoryMapMaxSizeMBString, 10, 32) |
||||
|
MemoryMapMaxSize := uint32(MemoryMapMaxSize64) |
||||
|
return MemoryMapMaxSize, err |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
package needle |
||||
|
|
||||
|
import "testing" |
||||
|
|
||||
|
func TestMemoryMapMaxSizeReadWrite(t *testing.T) { |
||||
|
memoryMapSize, _ := ReadMemoryMapMaxSizeMB("5000") |
||||
|
if memoryMapSize != 5000 { |
||||
|
t.Errorf("empty memoryMapSize:%v", memoryMapSize) |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue