Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-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
Levin Zimmermann
go-fuse
Commits
0b78f354
Commit
0b78f354
authored
Apr 26, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add magic .drop_cache file.
parent
f1e3a827
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
unionfs/dircache.go
unionfs/dircache.go
+7
-5
unionfs/timedcache.go
unionfs/timedcache.go
+6
-0
unionfs/unionfs.go
unionfs/unionfs.go
+8
-1
No files found.
unionfs/dircache.go
View file @
0b78f354
...
...
@@ -57,11 +57,13 @@ func (me *DirCache) setMap(newMap map[string]bool) {
me
.
names
=
newMap
me
.
updateRunning
=
false
_
=
time
.
AfterFunc
(
me
.
ttlNs
,
func
()
{
me
.
lock
.
Lock
()
me
.
names
=
nil
me
.
lock
.
Unlock
()
})
func
()
{
me
.
DropCache
()
})
}
func
(
me
*
DirCache
)
DropCache
()
{
me
.
lock
.
Lock
()
me
.
names
=
nil
me
.
lock
.
Unlock
()
}
// Try to refresh: if another update is already running, do nothing,
...
...
unionfs/timedcache.go
View file @
0b78f354
...
...
@@ -82,3 +82,9 @@ func (me *TimedCache) Purge() {
me
.
cacheMap
[
k
]
=
nil
,
false
}
}
func
(
me
*
TimedCache
)
RecurringPurge
()
{
me
.
Purge
()
time
.
AfterFunc
(
5
*
me
.
ttlNs
,
func
()
{
me
.
RecurringPurge
()
})
}
unionfs/unionfs.go
View file @
0b78f354
...
...
@@ -26,6 +26,7 @@ func filePathHash(path string) string {
return
fmt
.
Sprintf
(
"%x-%s"
,
h
.
Sum
()[
:
8
],
base
)
}
/*
UnionFs implements a user-space union file system, which is
...
...
@@ -103,6 +104,7 @@ func NewUnionFs(roots []string, options UnionFsOptions) *UnionFs {
g
.
branchCache
=
NewTimedCache
(
func
(
n
string
)
interface
{}
{
return
g
.
getBranchAttrNoCache
(
n
)
},
int64
(
options
.
BranchCacheTTLSecs
*
1e9
))
g
.
branchCache
.
RecurringPurge
()
return
g
}
...
...
@@ -300,7 +302,12 @@ func (me *UnionFs) Create(name string, flags uint32, mode uint32) (fuseFile fuse
}
func
(
me
*
UnionFs
)
GetAttr
(
name
string
)
(
a
*
fuse
.
Attr
,
s
fuse
.
Status
)
{
if
name
==
"READONLY"
{
if
name
==
_READONLY
{
return
nil
,
fuse
.
ENOENT
}
if
name
==
".drop_cache"
{
me
.
branchCache
.
Purge
()
me
.
deletionCache
.
DropCache
()
return
nil
,
fuse
.
ENOENT
}
if
name
==
me
.
options
.
DeletionDirName
{
...
...
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