Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
jacobsa-fuse
Commits
a932a654
Commit
a932a654
authored
Mar 20, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support flush/fsync errors.
parent
4eda8330
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
samples/flushfs/flush_fs.go
samples/flushfs/flush_fs.go
+3
-3
samples/flushfs/flush_fs_test.go
samples/flushfs/flush_fs_test.go
+10
-6
No files found.
samples/flushfs/flush_fs.go
View file @
a932a654
...
...
@@ -28,10 +28,10 @@ import (
//
// The file may be opened for reading and/or writing. Its initial contents are
// empty. Whenever a flush or fsync is received, the supplied function will be
// called with the current contents of the file.
// called with the current contents of the file
and its status returned
.
func
NewFileSystem
(
reportFlush
func
(
string
),
reportFsync
func
(
string
))
(
fs
fuse
.
FileSystem
,
err
error
)
{
reportFlush
func
(
string
)
error
,
reportFsync
func
(
string
)
error
)
(
fs
fuse
.
FileSystem
,
err
error
)
{
fs
=
&
flushFS
{}
return
}
...
...
samples/flushfs/flush_fs_test.go
View file @
a932a654
...
...
@@ -41,10 +41,12 @@ type FlushFSTest struct {
mu
sync
.
Mutex
// GUARDED_BY(mu)
flushes
[]
string
flushes
[]
string
flushErr
error
// GUARDED_BY(mu)
fsyncs
[]
string
fsyncs
[]
string
fsyncErr
error
}
func
init
()
{
RegisterTestSuite
(
&
FlushFSTest
{})
}
...
...
@@ -53,17 +55,19 @@ func (t *FlushFSTest) SetUp(ti *TestInfo) {
var
err
error
// Set up a file system.
reportTo
:=
func
(
slice
*
[]
string
)
func
(
string
)
{
return
func
(
s
string
)
{
reportTo
:=
func
(
slice
*
[]
string
,
err
*
error
)
func
(
string
)
error
{
return
func
(
s
string
)
error
{
t
.
mu
.
Lock
()
defer
t
.
mu
.
Unlock
()
*
slice
=
append
(
*
slice
,
s
)
return
*
err
}
}
t
.
FileSystem
,
err
=
flushfs
.
NewFileSystem
(
reportTo
(
&
t
.
flushes
),
reportTo
(
&
t
.
fsyncs
))
reportTo
(
&
t
.
flushes
,
&
t
.
flushErr
),
reportTo
(
&
t
.
fsyncs
,
&
t
.
fsyncErr
))
if
err
!=
nil
{
panic
(
err
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment