Merge pull request #1413 from harshavardhana/atomic
quick: Sync() not turned of by default
This commit is contained in:
+13
-4
@@ -23,6 +23,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// File container provided for atomic file writes
|
||||
@@ -31,13 +32,20 @@ type File struct {
|
||||
file string
|
||||
}
|
||||
|
||||
// Close the file replacing, returns an error if any
|
||||
func (f *File) Close() error {
|
||||
// CloseAndSync sync file to disk and close, returns an error if any
|
||||
func (f *File) CloseAndSync() error {
|
||||
// sync to the disk
|
||||
err := f.Sync()
|
||||
if err != nil {
|
||||
if err := f.File.Sync(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := f.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close the file, returns an error if any
|
||||
func (f *File) Close() error {
|
||||
// close the embedded fd
|
||||
if err := f.File.Close(); err != nil {
|
||||
return err
|
||||
@@ -74,6 +82,7 @@ func FileCreateWithPrefix(filePath string, prefix string) (*File, error) {
|
||||
if err := os.MkdirAll(filepath.Dir(filePath), 0700); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
prefix = strings.TrimSpace(prefix)
|
||||
f, err := ioutil.TempFile(filepath.Dir(filePath), prefix+filepath.Base(filePath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ func testDummy2() *probe.Error {
|
||||
|
||||
func (s *MySuite) TestProbe(c *C) {
|
||||
probe.Init() // Set project's root source path.
|
||||
probe.SetAppInfo("Release-Tag", "RELEASE.Sat-19-Sep-2015-06-15-16-GMT")
|
||||
probe.SetAppInfo("Commit-ID", "7390cc957239")
|
||||
es := testDummy2().Trace("TopOfStack")
|
||||
// Uncomment the following Println to visually test probe call trace.
|
||||
// fmt.Println("Expecting a simulated error here.", es)
|
||||
|
||||
Vendored
+6
-6
@@ -34,18 +34,18 @@
|
||||
},
|
||||
{
|
||||
"path": "github.com/minio/minio-xl/pkg/atomic",
|
||||
"revision": "008404af67dcf66bdde580245cd43951b425ed39",
|
||||
"revisionTime": "2015-11-17T16:21:42-08:00"
|
||||
"revision": "a32fbc1006b4a09176c91f57d22e87faff22a423",
|
||||
"revisionTime": "2015-11-17T22:59:41-08:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/minio/minio-xl/pkg/probe",
|
||||
"revision": "a7b8623fd546965505f18172717393f5de4139a2",
|
||||
"revisionTime": "2015-10-25T03:03:43-07:00"
|
||||
"revision": "a32fbc1006b4a09176c91f57d22e87faff22a423",
|
||||
"revisionTime": "2015-11-17T22:59:41-08:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/minio/minio-xl/pkg/quick",
|
||||
"revision": "008404af67dcf66bdde580245cd43951b425ed39",
|
||||
"revisionTime": "2015-11-17T16:21:42-08:00"
|
||||
"revision": "a32fbc1006b4a09176c91f57d22e87faff22a423",
|
||||
"revisionTime": "2015-11-17T22:59:41-08:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/minio/pb",
|
||||
|
||||
Reference in New Issue
Block a user