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
c919bfee
Commit
c919bfee
authored
Apr 17, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ccac4d70
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
10 deletions
+43
-10
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+31
-5
wcfs/wcfs.go
wcfs/wcfs.go
+3
-3
wcfs/δftail.go
wcfs/δftail.go
+9
-2
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
c919bfee
...
...
@@ -27,6 +27,10 @@ package xbtree
//go:generate ../../gen-set xbtree Object interface{} zset_object.go
import
(
"context"
"fmt"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
)
...
...
@@ -260,12 +264,15 @@ func (btail *ΔTail) ForgetPast(revCut zodb.Tid) {
//
// XXX at must ∈ (tail, head] XXX [tail ?
// XXX key must be tracked
func
(
δΒtail
*
ΔTail
)
Get
(
root
*
Tree
,
key
Key
,
at
zodb
.
Tid
)
(
value
Value
,
ok
bool
,
rev
zodb
.
Tid
,
revExact
bool
)
{
func
(
δΒtail
*
ΔTail
)
Get
(
ctx
context
.
Context
,
root
*
Tree
,
key
Key
,
at
zodb
.
Tid
)
(
value
Value
,
ok
bool
,
rev
zodb
.
Tid
,
revExact
bool
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"δBtail: root<%s>: get %s @%s"
,
root
.
POid
(),
key
,
at
)
// XXX key not tracked -> panic
// XXX at not ∈ (tail, head] -> panic
// XXX handle deletion
// FIXME stub -> that only ZBlk.rev is used
return
@
head
,
rev
=.
Tail
(),
revExact
=
false
//
return @head, rev=.Tail(), revExact=false
// XXX dirty -> rebuild
...
...
@@ -286,15 +293,34 @@ func (δΒtail *ΔTail) Get(root *Tree, key Key, at zodb.Tid) (value Value, ok b
}
}
//
found key in history
tail
//
key was found in δT ∈ δT
tail
if
ok
{
return
}
// key not in history tail
value
,
ok
=
δTtail
.
KVAtTail
[
key
]
// key not in history tail
.
// either use @tail[key], if it is present, or @head
[key]
rev
=
δΒtail
.
Tail
()
revExact
=
false
value
,
ok
=
δTtail
.
KVAtTail
[
key
]
if
ok
{
return
}
// @tail[key] is not present - key was not changing in (tail, head].
// since at ∈ (tail, head] we can use @head[key] as the result
xvalue
,
ok
,
err
:=
root
.
Get
(
ctx
,
key
)
if
err
!=
nil
{
return
}
v
,
ok
:=
xvalue
.
(
zodb
.
IPersistent
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"got %T; expect ZODB persistent reference"
,
xvalue
)
return
}
value
=
v
.
POid
()
ok
=
true
return
}
...
...
wcfs/wcfs.go
View file @
c919bfee
...
...
@@ -940,7 +940,7 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) {
if
int64
(
len
(
blkdata
))
==
blksize
{
func
()
{
// store retrieved data back to OS cache for file @<rev>/file[blk]
blkrev
,
_
:=
f
.
LastBlkRev
(
blk
,
f
.
head
.
zconn
.
At
())
blkrev
,
_
:=
f
.
LastBlkRev
(
ctx
,
blk
,
f
.
head
.
zconn
.
At
())
frev
,
frelease
,
err
:=
groot
.
mkrevfile
(
blkrev
,
f
.
zfile
.
POid
())
if
err
!=
nil
{
log
.
Errorf
(
"BUG: %s: invalidate blk #%d: %s (ignoring, but reading @revX/bigfile will be slow)"
,
f
.
path
(),
blk
,
err
)
...
...
@@ -1190,7 +1190,7 @@ func (f *BigFile) updateWatchers(ctx context.Context, blk int64, treepath []btre
// if blkrev is rough estimation and that upper bound is > w.at
// we have to recompute ~exact file[blk] revision @head.
if
blkrevRough
{
blkrev
,
_
=
f
.
LastBlkRev
(
blk
,
f
.
head
.
zconn
.
At
())
blkrev
,
_
=
f
.
LastBlkRev
(
ctx
,
blk
,
f
.
head
.
zconn
.
At
())
blkrevRough
=
false
if
blkrev
<=
w
.
at
{
...
...
@@ -1204,7 +1204,7 @@ func (f *BigFile) updateWatchers(ctx context.Context, blk int64, treepath []btre
// and most of them would be on different w.at - cache of the file will
// be lost. Via pinning to particular block revision, we make sure the
// revision to pin is the same on all clients, and so file cache is shared.
pinrev
,
_
:=
w
.
file
.
LastBlkRev
(
blk
,
w
.
at
)
// XXX move into go?
pinrev
,
_
:=
w
.
file
.
LastBlkRev
(
ctx
,
blk
,
w
.
at
)
// XXX move into go?
wg
.
Go
(
func
()
error
{
// XXX close watcher on any error
...
...
wcfs/δftail.go
View file @
c919bfee
...
...
@@ -20,6 +20,8 @@
package
main
import
(
"context"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
...
...
@@ -156,11 +158,16 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
// blk must be tracked
//
// XXX +ctx, error rebuild []δF here
func
(
f
*
BigFile
)
LastBlkRev
(
blk
int64
,
at
zodb
.
Tid
)
(
_
zodb
.
Tid
,
exact
bool
)
{
func
(
f
*
BigFile
)
LastBlkRev
(
ctx
context
.
Context
,
blk
int64
,
at
zodb
.
Tid
)
(
_
zodb
.
Tid
,
exact
bool
)
{
//defer xerr.Contextf(&err, "") // XXX text
δFtail
:=
f
.
head
.
bfdir
.
δFtail
// XXX tabRev -> treeRev ?
zblkOid
,
ok
,
tabRev
,
tabRevExact
:=
δFtail
.
δBtail
.
Get
(
f
.
zfile
.
blktab
,
blk
,
at
)
zblkOid
,
ok
,
tabRev
,
tabRevExact
,
err
:=
δFtail
.
δBtail
.
Get
(
ctx
,
f
.
zfile
.
blktab
,
blk
,
at
)
if
err
!=
nil
{
panic
(
err
)
}
// block was removed
// XXX or not in tracked set?
...
...
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