Ittt #52

Merged
anbsky merged 62 commits from ittt into master 2021-07-24 02:35:22 +02:00
3 changed files with 19 additions and 3 deletions
Showing only changes of commit 94e7d81bd3 - Show all commits

View file

@ -10,7 +10,6 @@ import (
"os"
"path"
"runtime"
"syscall"
"time"
"github.com/lbryio/reflector.go/shared"
@ -138,8 +137,7 @@ func (d *DiskStore) Put(hash string, blob stream.Blob) error {
}
// Open file with O_DIRECT
flags := os.O_WRONLY | os.O_CREATE | syscall.O_DIRECT
f, err := os.OpenFile(d.tmpPath(hash), flags, 0644)
f, err := os.OpenFile(d.tmpPath(hash), openFileFlags, 0644)
if err != nil {
return errors.Err(err)
}

9
store/flags_darwin.go Normal file
View file

@ -0,0 +1,9 @@
// +build darwin
package store
import (
"os"
)
var openFileFlags = os.O_WRONLY | os.O_CREATE

9
store/flags_linux.go Normal file
View file

@ -0,0 +1,9 @@
// +build linux
package store
import (
"os"
)
var openFileFlags = os.O_WRONLY | os.O_CREATE | syscall.O_DIRECT