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
c79c1d84
Commit
c79c1d84
authored
Mar 17, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented public functions.
parent
56f503ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
samples/cachingfs/caching_fs.go
samples/cachingfs/caching_fs.go
+28
-3
No files found.
samples/cachingfs/caching_fs.go
View file @
c79c1d84
...
...
@@ -15,6 +15,7 @@
package
cachingfs
import
(
"sync"
"time"
"github.com/jacobsa/fuse"
...
...
@@ -41,6 +42,13 @@ const (
// that are useful in testing that these durations are honored.
type
CachingFS
struct
{
fuseutil
.
NotImplementedFileSystem
mu
sync
.
Mutex
// GUARDED_BY(mu)
inodeIDBase
fuse
.
InodeID
// GUARDED_BY(mu)
mtime
time
.
Time
}
var
_
fuse
.
FileSystem
=
&
CachingFS
{}
...
...
@@ -59,7 +67,14 @@ var _ fuse.FileSystem = &CachingFS{}
//
func
NewCachingFS
(
lookupEntryTimeout
time
.
Duration
,
getattrTimeout
time
.
Duration
)
(
fs
*
CachingFS
,
err
error
)
getattrTimeout
time
.
Duration
)
(
fs
*
CachingFS
,
err
error
)
{
fs
=
&
CachingFS
{
inodeIDBase
:
fuse
.
RootInodeID
+
1
,
mtime
:
time
.
Now
(),
}
return
}
// Cause inodes to receive IDs according to the following rules in further
// responses to fuse:
...
...
@@ -72,8 +87,18 @@ func NewCachingFS(
// called with base set to fuse.RootInodeID + 1.
//
// REQUIRES: base > fuse.RootInodeID
func
(
fs
*
CachingFS
)
RenumberInodes
(
base
fuse
.
InodeID
)
func
(
fs
*
CachingFS
)
RenumberInodes
(
base
fuse
.
InodeID
)
{
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
fs
.
inodeIDBase
=
base
}
// Cause further queries for the attributes of inodes to use the supplied time
// as the inode's mtime.
func
(
fs
*
CachingFS
)
SetMtime
(
mtime
time
.
Time
)
func
(
fs
*
CachingFS
)
SetMtime
(
mtime
time
.
Time
)
{
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
fs
.
mtime
=
mtime
}
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