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
6a1e4f53
Commit
6a1e4f53
authored
Apr 05, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8c352458
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
wcfs/zblk.go
wcfs/zblk.go
+14
-15
No files found.
wcfs/zblk.go
View file @
6a1e4f53
...
@@ -44,10 +44,9 @@ import (
...
@@ -44,10 +44,9 @@ import (
"sync"
"sync"
"syscall"
"syscall"
"golang.org/x/sync/errgroup"
"lab.nexedi.com/kirr/go123/mem"
"lab.nexedi.com/kirr/go123/mem"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xsync"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
pickle
"github.com/kisielk/og-rek"
pickle
"github.com/kisielk/og-rek"
...
@@ -265,10 +264,10 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
...
@@ -265,10 +264,10 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
}()
}()
wg
,
ctx
:=
errgroup
.
WithContext
(
ctx
)
wg
:=
xsync
.
NewWorkGroup
(
ctx
)
// loadZData loads 1 ZData object into chunktab and leaves it activated.
// loadZData loads 1 ZData object into chunktab and leaves it activated.
loadZData
:=
func
(
offset
int32
,
zd
*
ZData
)
error
{
loadZData
:=
func
(
ctx
context
.
Context
,
offset
int32
,
zd
*
ZData
)
error
{
err
:=
zd
.
PActivate
(
ctx
)
err
:=
zd
.
PActivate
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -284,7 +283,7 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
...
@@ -284,7 +283,7 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
}
}
// loadBucket loads all ZData objects from leaf BTree bucket.
// loadBucket loads all ZData objects from leaf BTree bucket.
loadBucket
:=
func
(
b
*
btree
.
IOBucket
)
error
{
loadBucket
:=
func
(
ctx
context
.
Context
,
b
*
btree
.
IOBucket
)
error
{
err
:=
b
.
PActivate
(
ctx
)
err
:=
b
.
PActivate
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -305,8 +304,8 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
...
@@ -305,8 +304,8 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
}
}
offset
:=
e
.
Key
()
offset
:=
e
.
Key
()
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
return
loadZData
(
offset
,
zd
)
return
loadZData
(
ctx
,
offset
,
zd
)
})
})
}
}
...
@@ -314,8 +313,8 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
...
@@ -314,8 +313,8 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
}
}
// loadBTree spawns loading of all BTree children.
// loadBTree spawns loading of all BTree children.
var
loadBTree
func
(
t
*
btree
.
IOBTree
)
error
var
loadBTree
func
(
ctx
context
.
Context
,
t
*
btree
.
IOBTree
)
error
loadBTree
=
func
(
t
*
btree
.
IOBTree
)
error
{
loadBTree
=
func
(
ctx
context
.
Context
,
t
*
btree
.
IOBTree
)
error
{
err
:=
t
.
PActivate
(
ctx
)
err
:=
t
.
PActivate
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -327,13 +326,13 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
...
@@ -327,13 +326,13 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
for
_
,
e
:=
range
t
.
Entryv
()
{
for
_
,
e
:=
range
t
.
Entryv
()
{
switch
child
:=
e
.
Child
()
.
(
type
)
{
switch
child
:=
e
.
Child
()
.
(
type
)
{
case
*
btree
.
IOBTree
:
case
*
btree
.
IOBTree
:
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
return
loadBTree
(
child
)
return
loadBTree
(
c
tx
,
c
hild
)
})
})
case
*
btree
.
IOBucket
:
case
*
btree
.
IOBucket
:
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
return
loadBucket
(
child
)
return
loadBucket
(
c
tx
,
c
hild
)
})
})
default
:
default
:
...
@@ -344,8 +343,8 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
...
@@ -344,8 +343,8 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, zodb.Tid, error) {
return
nil
return
nil
}
}
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
return
loadBTree
(
zb
.
chunktab
)
return
loadBTree
(
ctx
,
zb
.
chunktab
)
})
})
err
=
wg
.
Wait
()
err
=
wg
.
Wait
()
...
...
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