Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
1fde1d07
Commit
1fde1d07
authored
Mar 20, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0ff2cd10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
wcfs/wcfs.go
wcfs/wcfs.go
+18
-8
No files found.
wcfs/wcfs.go
View file @
1fde1d07
...
...
@@ -477,7 +477,16 @@ type Head struct {
type
Watch
struct
{
fsNode
// TODO
// head/watch opens
// XXX protected by ... head.zconnMu ?
watchTab
map
[
*
Watcher
]
struct
{}
}
// /head/watch handle - served by Watcher.
type
Watcher
struct
{
sk
*
FileSock
// XXX
}
// /(head|<rev>)/bigfile/ - served by BigFileDir.
...
...
@@ -580,7 +589,7 @@ func (_ *zodbCacheControl) PCacheClassify(obj zodb.IPersistent) zodb.PCachePolic
return
0
}
func
traceWatch
(
format
string
,
argv
...
interface
{})
{
func
trace
Z
Watch
(
format
string
,
argv
...
interface
{})
{
if
!
log
.
V
(
1
)
{
// XXX -> 2?
return
}
...
...
@@ -595,7 +604,7 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
defer
xerr
.
Contextf
(
&
err
,
"zwatch"
)
// XXX more in context?
// XXX unmount on error? -> always EIO?
traceWatch
(
">>>"
)
trace
Z
Watch
(
">>>"
)
zwatchq
:=
make
(
chan
zodb
.
Event
)
at0
:=
root
.
zstor
.
AddWatch
(
zwatchq
)
// XXX -> to main thread to avoid race
...
...
@@ -606,22 +615,22 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
var
ok
bool
for
{
traceWatch
(
"select ..."
)
trace
Z
Watch
(
"select ..."
)
select
{
case
<-
ctx
.
Done
()
:
traceWatch
(
"cancel"
)
trace
Z
Watch
(
"cancel"
)
return
ctx
.
Err
()
// TODO handle errors from ZODB watch stream
case
zevent
,
ok
=
<-
zwatchq
:
if
!
ok
{
traceWatch
(
"zwatchq closed"
)
trace
Z
Watch
(
"zwatchq closed"
)
return
nil
// closed XXX ok?
}
}
traceWatch
(
"zevent: %s"
,
zevent
)
trace
Z
Watch
(
"zevent: %s"
,
zevent
)
var
zδ
*
zodb
.
EventCommit
switch
zevent
:=
zevent
.
(
type
)
{
...
...
@@ -1561,6 +1570,7 @@ func main() {
watch
:=
&
Watch
{
fsNode
:
newFSNode
(
fSticky
),
watchTab
:
make
(
map
[
*
Watcher
]
struct
{}),
}
bfdir
:=
&
BigFileDir
{
...
...
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