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
5ed9cbc0
Commit
5ed9cbc0
authored
Aug 10, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
512d593d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
1 deletion
+66
-1
wcfs/zblk.go
wcfs/zblk.go
+66
-1
No files found.
wcfs/zblk.go
View file @
5ed9cbc0
...
...
@@ -25,6 +25,9 @@ import (
"context"
"fmt"
"reflect"
"sync"
"golang.org/x/sync/errgroup"
"lab.nexedi.com/kirr/go123/mem"
"lab.nexedi.com/kirr/neo/go/zodb"
...
...
@@ -121,7 +124,69 @@ func (zb *zBlk1State) PySetState(pystate interface{}) error {
}
func
(
zb
*
ZBlk1
)
LoadBlkData
(
ctx
context
.
Context
)
([]
byte
,
error
)
{
// XXX empty .chunktab -> ø
// // empty .chunktab -> ø
// ev := zb.chunktab.Entryv()
// if len(ev) == 0 {
// return nil, nil
// }
// get to all ZData objects; activate them and build
//
// {} offset -> ZData
//
// with all ZData being live.
var
mu
sync
.
Mutex
chunktab
:=
make
(
map
[
int64
]
*
ZData
)
wg
,
ctx
:=
errgroup
.
WithContext
(
ctx
)
// loadBTree spawns loading of all BTree children.
loadBTree
:=
func
(
t
*
btree
.
BTree
)
error
{
err
:=
t
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
err
}
defer
t
.
PDeactivate
()
for
_
,
e
:=
range
t
.
Entryv
()
{
switch
child
:=
e
.
Child
()
.
(
type
)
{
case
*
btree
.
BTree
:
wg
.
Go
(
func
()
error
{
return
loadBtree
(
child
)
})
case
*
btree
.
Bucket
:
wg
.
Go
(
func
()
error
{
return
loadBucket
(
child
)
})
default
:
panic
(
0
)
// XXX
}
}
return
nil
}
// loadBucket loads all ZData objects from leaf BTree bucket.
loadBucket
:=
func
(
b
*
btree
.
Bucket
)
error
{
err
:=
b
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
err
}
defer
b
.
PDeactivate
()
// XXX go through all bucket key/v -> chunktab
// XXX off < 0 !ok
// XXX off + len > blksize !ok
return
nil
}
loadBTree
(
zb
.
chunktab
)
// XXX err
panic
(
"TODO"
)
}
...
...
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