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
c4e16704
Commit
c4e16704
authored
Oct 12, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ca31958e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
22 deletions
+17
-22
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+0
-2
wcfs/internal/zdata/zblk.go
wcfs/internal/zdata/zblk.go
+15
-15
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+2
-5
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
c4e16704
...
...
@@ -387,8 +387,6 @@ func (δBtail *ΔBtail) Tail() zodb.Tid { return δBtail.δZtail.Tail() }
// All path elements must be Tree except last one which, for non-empty tree, must be Bucket.
//
// Objects in the path must be with .PJar().At() == .Head()
//
// XXX put keycov back to come first?
func
(
δBtail
*
ΔBtail
)
Track
(
nodePath
[]
Node
,
keycov
KeyRange
)
{
head
:=
δBtail
.
Head
()
for
_
,
node
:=
range
nodePath
{
...
...
wcfs/internal/zdata/zblk.go
View file @
c4e16704
...
...
@@ -417,24 +417,24 @@ func (bf *ZBigFile) BlkSize() int64 {
// which provides a rough upper-bound estimate for file[blk] revision.
//
// TODO load into user-provided buf.
// XXX blkCov -> treeLeafCov ?
func
(
bf
*
ZBigFile
)
LoadBlk
(
ctx
context
.
Context
,
blk
int64
)
(
_
[]
byte
,
treePath
[]
btree
.
LONode
,
blkCov
btree
.
LKeyRange
,
zblk
ZBlk
,
blkRevMax
zodb
.
Tid
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"bigfile %s: loadblk %d"
,
bf
.
POid
(),
blk
)
kø
:=
btree
.
LKeyRange
{
Lo
:
0
,
Hi_
:
-
1
}
// empty KeyRange
err
=
bf
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
nil
,
nil
,
btree
.
LKeyRange
{}
,
nil
,
0
,
err
return
nil
,
nil
,
kø
,
nil
,
0
,
err
}
defer
bf
.
PDeactivate
()
blkRevMax
=
0
xzblk
,
ok
,
err
:=
bf
.
blktab
.
VGet
(
ctx
,
blk
,
func
(
node
btree
.
LONode
,
keycov
btree
.
LKeyRange
)
{
blkCov
=
keycov
// will be set last for leaf
treePath
=
append
(
treePath
,
node
)
blkCov
=
keycov
// will be set last for leaf
blkRevMax
=
tidmax
(
blkRevMax
,
node
.
PSerial
())
})
if
err
!=
nil
{
return
nil
,
nil
,
btree
.
LKeyRange
{}
,
nil
,
0
,
err
return
nil
,
nil
,
kø
,
nil
,
0
,
err
}
if
!
ok
{
return
make
([]
byte
,
bf
.
blksize
),
treePath
,
blkCov
,
nil
,
blkRevMax
,
nil
...
...
@@ -442,18 +442,18 @@ func (bf *ZBigFile) LoadBlk(ctx context.Context, blk int64) (_ []byte, treePath
zblk
,
err
=
vZBlk
(
xzblk
)
if
err
!=
nil
{
return
nil
,
nil
,
btree
.
LKeyRange
{}
,
nil
,
0
,
err
return
nil
,
nil
,
kø
,
nil
,
0
,
err
}
blkdata
,
zblkrev
,
err
:=
zblk
.
LoadBlkData
(
ctx
)
if
err
!=
nil
{
return
nil
,
nil
,
btree
.
LKeyRange
{}
,
nil
,
0
,
err
return
nil
,
nil
,
kø
,
nil
,
0
,
err
}
blkRevMax
=
tidmax
(
blkRevMax
,
zblkrev
)
l
:=
int64
(
len
(
blkdata
))
if
l
>
bf
.
blksize
{
return
nil
,
nil
,
btree
.
LKeyRange
{}
,
nil
,
0
,
fmt
.
Errorf
(
"zblk %s: invalid blk: size = %d (> blksize = %d)"
,
zblk
.
POid
(),
l
,
bf
.
blksize
)
return
nil
,
nil
,
kø
,
nil
,
0
,
fmt
.
Errorf
(
"zblk %s: invalid blk: size = %d (> blksize = %d)"
,
zblk
.
POid
(),
l
,
bf
.
blksize
)
}
// append trailing \0 to data to reach .blksize
...
...
@@ -469,33 +469,33 @@ func (bf *ZBigFile) LoadBlk(ctx context.Context, blk int64) (_ []byte, treePath
// Size returns whole file size.
//
// it also returns BTree path scanned to obtain the size.
// XXX naming leafCov -> blkCov ?
func
(
bf
*
ZBigFile
)
Size
(
ctx
context
.
Context
)
(
_
int64
,
treePath
[]
btree
.
LONode
,
leafCov
btree
.
LKeyRange
,
err
error
)
{
func
(
bf
*
ZBigFile
)
Size
(
ctx
context
.
Context
)
(
_
int64
,
treePath
[]
btree
.
LONode
,
blkCov
btree
.
LKeyRange
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"bigfile %s: size"
,
bf
.
POid
())
kø
:=
btree
.
LKeyRange
{
Lo
:
0
,
Hi_
:
-
1
}
// empty KeyRange
err
=
bf
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
0
,
nil
,
btree
.
LKeyRange
{}
,
err
return
0
,
nil
,
kø
,
err
}
defer
bf
.
PDeactivate
()
tailblk
,
ok
,
err
:=
bf
.
blktab
.
VMaxKey
(
ctx
,
func
(
node
btree
.
LONode
,
keycov
btree
.
LKeyRange
)
{
leafCov
=
keycov
// will be set last for leaf
treePath
=
append
(
treePath
,
node
)
blkCov
=
keycov
// will be set last for leaf
})
if
err
!=
nil
{
return
0
,
nil
,
btree
.
LKeyRange
{}
,
err
return
0
,
nil
,
kø
,
err
}
if
!
ok
{
return
0
,
treePath
,
leaf
Cov
,
nil
return
0
,
treePath
,
blk
Cov
,
nil
}
size
:=
(
tailblk
+
1
)
*
bf
.
blksize
if
size
/
bf
.
blksize
!=
tailblk
+
1
{
return
0
,
nil
,
btree
.
LKeyRange
{}
,
syscall
.
EFBIG
// overflow
return
0
,
nil
,
kø
,
syscall
.
EFBIG
// overflow
}
return
size
,
treePath
,
leaf
Cov
,
nil
return
size
,
treePath
,
blk
Cov
,
nil
}
// vZBlk checks and converts xzblk to a ZBlk object.
...
...
wcfs/internal/zdata/δftail.go
View file @
c4e16704
...
...
@@ -195,13 +195,13 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
// ---- Track/rebuild/Update/Forget ----
// Track associates file[blk
cov]@head with tree path and zblk object
.
// Track associates file[blk
]@head with zblk object and file[blkcov]@head with tree path
.
//
// Path root becomes associated with the file, and the path and zblk object become tracked.
// One root can be associated with several files (each provided on different Track calls).
//
// zblk can be nil, which represents a hole.
//
XXX kill: blk=-1 should be used for tracking after ZBigFile.Size() query (no zblk is accessed at all)
.
//
if zblk is nil -> blk is ignored and can be arbitrary
.
//
// Objects in path and zblk must be with .PJar().At() == .head
func
(
δFtail
*
ΔFtail
)
Track
(
file
*
ZBigFile
,
blk
int64
,
path
[]
btree
.
LONode
,
blkcov
btree
.
LKeyRange
,
zblk
ZBlk
)
{
...
...
@@ -222,9 +222,6 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, bl
// path.at == head is verified by ΔBtail.Track
foid
:=
file
.
POid
()
// if blk == -1 {
// blk = xbtree.KeyMax
// }
δFtail
.
δBtail
.
Track
(
path
,
blkcov
)
rootObj
:=
path
[
0
]
.
(
*
btree
.
LOBTree
)
...
...
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