Konstantin Lebedev
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
10 additions and
2 deletions
-
weed/storage/backend/disk_file.go
|
|
@ -4,6 +4,7 @@ import ( |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/glog" |
|
|
|
. "github.com/seaweedfs/seaweedfs/weed/storage/types" |
|
|
|
"os" |
|
|
|
"runtime" |
|
|
|
"time" |
|
|
|
) |
|
|
|
|
|
|
@ -11,6 +12,8 @@ var ( |
|
|
|
_ BackendStorageFile = &DiskFile{} |
|
|
|
) |
|
|
|
|
|
|
|
const isMac = runtime.GOOS == "darwin" |
|
|
|
|
|
|
|
type DiskFile struct { |
|
|
|
File *os.File |
|
|
|
fullFilePath string |
|
|
@ -81,6 +84,11 @@ func (df *DiskFile) Name() string { |
|
|
|
} |
|
|
|
|
|
|
|
func (df *DiskFile) Sync() error { |
|
|
|
return nil |
|
|
|
// return df.File.Sync()
|
|
|
|
if df.File == nil { |
|
|
|
return os.ErrInvalid |
|
|
|
} |
|
|
|
if isMac { |
|
|
|
return nil |
|
|
|
} |
|
|
|
return df.File.Sync() |
|
|
|
} |