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
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
Joshua
wendelin.core
Commits
00e14419
Commit
00e14419
authored
Feb 05, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
94389dd3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
30 deletions
+27
-30
wcfs/wcfs.go
wcfs/wcfs.go
+7
-15
wcfs/zblk.go
wcfs/zblk.go
+20
-15
No files found.
wcfs/wcfs.go
View file @
00e14419
...
...
@@ -1156,27 +1156,19 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) error {
// noone was loading - we became reponsible to load this block
zbf
:=
f
.
zbf
blkdata
,
treepath
,
err
:=
zbf
.
LoadBlk
(
ctx
,
blk
)
// XXX -> +blkrevmax1
blkdata
,
treepath
,
blkpathRevMax
,
err
:=
zbf
.
LoadBlk
(
ctx
,
blk
)
loading
.
blkdata
=
blkdata
loading
.
err
=
err
close
(
loading
.
ready
)
_
=
treepath
/*
blkrevmax := zodb.Tid(0)
for __, node := range treepath {
node.PActivate() // XXX err
blkrevmax = max(_, node.PSerial())
node.PDeactivate()
}
*/
// XXX locking
_
=
treepath
// TODO -> btreeMap
// XXX before loading.ready?
blkrevmax
2
,
_
:=
f
.
δFtail
.
LastRevOf
(
blk
,
zbf
.
PJar
()
.
At
())
//revmax := min(blkrevmax1, blkrevmax2)
revmax
:=
blkrevmax2
_
=
revmax
blkrevmax
,
_
:=
f
.
δFtail
.
LastRevOf
(
blk
,
zbf
.
PJar
()
.
At
())
if
blkpathRevMax
<
blkrevmax
{
blkrevmax
=
blkpathRevMax
}
/*
// XXX remmapping - only if head.rev == 0
...
...
wcfs/zblk.go
View file @
00e14419
...
...
@@ -440,44 +440,49 @@ func (bf *zBigFileState) PySetState(pystate interface{}) (err error) {
// LoadBlk loads data for file block #blk.
//
// it also returns BTree path in .blktab for loaded block.
// it also returns:
//
// - BTree path in .blktab for loaded block,
// - maximum revision of nodes in the BTree path.
//
// XXX better load into user-provided buf?
func
(
bf
*
ZBigFile
)
LoadBlk
(
ctx
context
.
Context
,
blk
int64
)
(
_
[]
byte
,
treePath
[]
zodb
.
IPersistent
,
err
error
)
{
func
(
bf
*
ZBigFile
)
LoadBlk
(
ctx
context
.
Context
,
blk
int64
)
(
_
[]
byte
,
treePath
[]
zodb
.
IPersistent
,
pathRevMax
zodb
.
Tid
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"bigfile %s: loadblk %d"
,
bf
.
POid
(),
blk
)
err
=
bf
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
0
,
err
}
defer
bf
.
PDeactivate
()
// XXX -> GetTo(callback(node) - use node.PSerial to build maxrev + treepath)
xzblk
,
ok
,
treev
,
bucket
,
err
:=
bf
.
blktab
.
GetTo
(
ctx
,
blk
)
pathRevMax
=
0
xzblk
,
ok
,
err
:=
bf
.
blktab
.
GetTo
(
ctx
,
blk
,
func
(
node
zodb
.
IPersistent
)
{
treePath
=
append
(
treePath
,
node
)
rev
:=
node
.
PSerial
()
if
rev
>
pathRevMax
{
pathRevMax
=
rev
}
})
if
err
!=
nil
{
return
nil
,
nil
,
err
}
for
_
,
tree
:=
range
treev
{
treePath
=
append
(
treePath
,
tree
)
return
nil
,
nil
,
0
,
err
}
treePath
=
append
(
treePath
,
bucket
)
if
!
ok
{
return
make
([]
byte
,
bf
.
blksize
),
treePath
,
nil
return
make
([]
byte
,
bf
.
blksize
),
treePath
,
pathRevMax
,
nil
}
zblk
,
ok
:=
xzblk
.
(
zBlk
)
if
!
ok
{
return
nil
,
nil
,
fmt
.
Errorf
(
"expect ZBlk*; got %s"
,
typeOf
(
xzblk
))
return
nil
,
nil
,
0
,
fmt
.
Errorf
(
"expect ZBlk*; got %s"
,
typeOf
(
xzblk
))
}
blkdata
,
err
:=
zblk
.
loadBlkData
(
ctx
)
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
0
,
err
}
l
:=
int64
(
len
(
blkdata
))
if
l
>
bf
.
blksize
{
return
nil
,
nil
,
fmt
.
Errorf
(
"invalid blk: size = %d (> blksize = %d)"
,
l
,
bf
.
blksize
)
return
nil
,
nil
,
0
,
fmt
.
Errorf
(
"invalid blk: size = %d (> blksize = %d)"
,
l
,
bf
.
blksize
)
}
// append trailing \0 to data to reach .blksize
...
...
@@ -490,7 +495,7 @@ func (bf *ZBigFile) LoadBlk(ctx context.Context, blk int64) (_ []byte, treePath
zblk
.
bindZFile
(
bf
,
blk
)
//log.Printf("ZBigFile.loadblk(%d) -> %dB", blk, len(blkdata))
return
blkdata
,
treePath
,
nil
return
blkdata
,
treePath
,
pathRevMax
,
nil
}
// Size returns whole file size.
...
...
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