mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-22 04:27:24 +08:00
rename function
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/chrislusf/seaweedfs/weed/storage/backend"
|
"github.com/chrislusf/seaweedfs/weed/storage/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createVolumeFile(fileName string, preallocate int64, memoryMapSizeMB uint32) (backend.BackendStorageFile, error) {
|
func CreateVolumeFile(fileName string, preallocate int64, memoryMapSizeMB uint32) (backend.BackendStorageFile, error) {
|
||||||
file, e := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
file, e := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return nil, e
|
return nil, e
|
||||||
|
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/chrislusf/seaweedfs/weed/storage/backend"
|
"github.com/chrislusf/seaweedfs/weed/storage/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createVolumeFile(fileName string, preallocate int64, memoryMapSizeMB uint32) (backend.BackendStorageFile, error) {
|
func CreateVolumeFile(fileName string, preallocate int64, memoryMapSizeMB uint32) (backend.BackendStorageFile, error) {
|
||||||
file, e := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
file, e := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return nil, e
|
return nil, e
|
||||||
|
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/chrislusf/seaweedfs/weed/storage/backend/memory_map/os_overloads"
|
"github.com/chrislusf/seaweedfs/weed/storage/backend/memory_map/os_overloads"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createVolumeFile(fileName string, preallocate int64, memoryMapSizeMB uint32) (backend.BackendStorageFile, error) {
|
func CreateVolumeFile(fileName string, preallocate int64, memoryMapSizeMB uint32) (backend.BackendStorageFile, error) {
|
||||||
if preallocate > 0 {
|
if preallocate > 0 {
|
||||||
glog.V(0).Infof("Preallocated disk space for %s is not supported", fileName)
|
glog.V(0).Infof("Preallocated disk space for %s is not supported", fileName)
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
|
|||||||
v.DataBackend = backend.NewDiskFile(dataFile)
|
v.DataBackend = backend.NewDiskFile(dataFile)
|
||||||
} else {
|
} else {
|
||||||
if createDatIfMissing {
|
if createDatIfMissing {
|
||||||
v.DataBackend, err = createVolumeFile(fileName+".dat", preallocate, v.MemoryMapMaxSizeMb)
|
v.DataBackend, err = CreateVolumeFile(fileName+".dat", preallocate, v.MemoryMapMaxSizeMb)
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("Volume Data file %s.dat does not exist.", fileName)
|
return fmt.Errorf("Volume Data file %s.dat does not exist.", fileName)
|
||||||
}
|
}
|
||||||
|
@@ -354,7 +354,7 @@ func (v *Volume) copyDataAndGenerateIndexFile(dstName, idxName string, prealloca
|
|||||||
var (
|
var (
|
||||||
dst backend.BackendStorageFile
|
dst backend.BackendStorageFile
|
||||||
)
|
)
|
||||||
if dst, err = createVolumeFile(dstName, preallocate, 0); err != nil {
|
if dst, err = CreateVolumeFile(dstName, preallocate, 0); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer dst.Close()
|
defer dst.Close()
|
||||||
@@ -383,7 +383,7 @@ func copyDataBasedOnIndexFile(srcDatName, srcIdxName, dstDatName, datIdxName str
|
|||||||
srcDatBackend, dstDatBackend backend.BackendStorageFile
|
srcDatBackend, dstDatBackend backend.BackendStorageFile
|
||||||
dataFile *os.File
|
dataFile *os.File
|
||||||
)
|
)
|
||||||
if dstDatBackend, err = createVolumeFile(dstDatName, preallocate, 0); err != nil {
|
if dstDatBackend, err = CreateVolumeFile(dstDatName, preallocate, 0); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer dstDatBackend.Close()
|
defer dstDatBackend.Close()
|
||||||
|
Reference in New Issue
Block a user