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
acec3cf1
Commit
acec3cf1
authored
Jul 01, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f0afdaf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
20 deletions
+12
-20
wcfs/wcfs.go
wcfs/wcfs.go
+12
-20
No files found.
wcfs/wcfs.go
View file @
acec3cf1
...
...
@@ -570,8 +570,7 @@ type BigFile struct {
// progress of being established. XXX text
//
// XXX locking -> watchMu?
// XXX -> watchTab ?
watches
map
[
*
Watch
]
struct
{}
watchTab
map
[
*
Watch
]
struct
{}
}
// blkLoadState represents a ZBlk load state/result.
...
...
@@ -599,7 +598,7 @@ type WatchLink struct {
id
int32
// ID of this /head/watch handle (for debug log)
head
*
Head
//
established watches
.
//
watches established over this watch link
.
// XXX in-progress - where? -> (XXX no - see vvv) nowhere; here only established watches are added
// XXX -> in-progress here - so that access to new blocks after δFtail
// was queried also send pins.
...
...
@@ -951,7 +950,7 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) {
delete
(
f
.
loading
,
blk
)
}
// TODO skip retrieve/store if len(f.watch
es
) == 0
// TODO skip retrieve/store if len(f.watch
Tab
) == 0
// try to retrieve cache of current head/data[blk], if we got nothing from f.loading
if
blkdata
==
nil
{
blkdata
=
make
([]
byte
,
blksize
)
...
...
@@ -1196,7 +1195,7 @@ func (f *BigFile) updateWatchers(ctx context.Context, blk int64, treepath []btre
return
}
fmt
.
Printf
(
"S: read #%d -> update watchers (#%d)
\n
"
,
blk
,
len
(
f
.
watch
es
))
fmt
.
Printf
(
"S: read #%d -> update watchers (#%d)
\n
"
,
blk
,
len
(
f
.
watch
Tab
))
// update δFtail index
bfdir
:=
f
.
head
.
bfdir
...
...
@@ -1204,13 +1203,6 @@ func (f *BigFile) updateWatchers(ctx context.Context, blk int64, treepath []btre
bfdir
.
δFtail
.
Track
(
f
,
blk
,
treepath
,
zblk
)
// XXX pass in zblk.rev here?
bfdir
.
δFmu
.
Unlock
()
/* XXX kill
// associate zblk with file, if data was not hole
if zblk != nil {
zblk.bindFile(f, blk)
}
*/
// makes sure that file[blk] on clients side stays as of @w.at state.
// try to use blkrevMax only as the first cheap criteria to skip updating watchers.
...
...
@@ -1220,10 +1212,10 @@ func (f *BigFile) updateWatchers(ctx context.Context, blk int64, treepath []btre
blkrev
:=
blkrevMax
blkrevRough
:=
true
// XXX locking (f.watch
es
)
// XXX locking (f.watch
Tab
)
wg
,
ctx
:=
errgroup
.
WithContext
(
ctx
)
for
w
:=
range
f
.
watch
es
{
for
w
:=
range
f
.
watch
Tab
{
w
:=
w
fmt
.
Printf
(
"S: read -> update watchers: w @%s
\n
"
,
w
.
at
)
...
...
@@ -1429,7 +1421,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// XXX locking
if
at
==
zodb
.
InvalidTid
{
delete
(
wlink
.
byfile
,
foid
)
delete
(
w
.
file
.
watch
es
,
w
)
delete
(
w
.
file
.
watch
Tab
,
w
)
return
nil
}
...
...
@@ -1471,7 +1463,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// δFtail query and pin-sent to w. Block #3 was not yet accessed but
// was also changed after w.at . As head/file[#3] might be accessed
// simultaneously to watch setup, and f.readBlk will be checking
// f.watch
es; if w ∉ f.watches
at that moment, w will miss to receive
// f.watch
Tab; if w ∉ f.watchTab
at that moment, w will miss to receive
// pin for #3.
//
// NOTE for `unpin blk` to -> @head we can be sure there won't be
...
...
@@ -1492,7 +1484,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
//
// XXX locking
// XXX register only if watch was created anew, not updated?
f
.
watch
es
[
w
]
=
struct
{}{}
f
.
watch
Tab
[
w
]
=
struct
{}{}
wlink
.
byfile
[
foid
]
=
w
// XXX defer -> unregister watch if error?
...
...
@@ -1545,7 +1537,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
}
// XXX or register w to f & wlink here?
// NOTE registering f.watch
es
[w] and wlink.byfile[foid] = w must come together.
// NOTE registering f.watch
Tab
[w] and wlink.byfile[foid] = w must come together.
return
nil
}
...
...
@@ -1613,7 +1605,7 @@ func (wlink *WatchLink) _serve() (err error) {
// unregister all watches created on this wlink
// XXX locking
for
_
,
w
:=
range
wlink
.
byfile
{
delete
(
w
.
file
.
watch
es
,
w
)
delete
(
w
.
file
.
watch
Tab
,
w
)
}
wlink
.
byfile
=
nil
...
...
@@ -1996,7 +1988,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
// FIXME: scan zfile.blktab - so that we can detect all btree changes
// see "XXX building δFtail lazily ..." in notes.txt
f
.
watch
es
=
make
(
map
[
*
Watch
]
struct
{})
f
.
watch
Tab
=
make
(
map
[
*
Watch
]
struct
{})
}
return
f
,
nil
...
...
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