mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 08:29:24 +08:00
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:
14
weed/storage/needle/volume_memory_map_max_size.go
Normal file
14
weed/storage/needle/volume_memory_map_max_size.go
Normal file
@@ -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
|
||||
}
|
10
weed/storage/needle/volume_memory_map_max_size_test.go
Normal file
10
weed/storage/needle/volume_memory_map_max_size_test.go
Normal file
@@ -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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user