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
eaa44e39
Commit
eaa44e39
authored
Aug 10, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c187f0ba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
1 deletion
+41
-1
wcfs/zblk.go
wcfs/zblk.go
+41
-1
No files found.
wcfs/zblk.go
View file @
eaa44e39
...
...
@@ -124,6 +124,8 @@ func (zb *zBlk1State) PySetState(pystate interface{}) error {
}
func
(
zb
*
ZBlk1
)
LoadBlkData
(
ctx
context
.
Context
)
([]
byte
,
error
)
{
// XXX errctx
// // empty .chunktab -> ø
// ev := zb.chunktab.Entryv()
// if len(ev) == 0 {
...
...
@@ -140,6 +142,22 @@ func (zb *ZBlk1) LoadBlkData(ctx context.Context) ([]byte, error) {
wg
,
ctx
:=
errgroup
.
WithContext
(
ctx
)
// loadZData loads 1 ZData object into chunktab and leaves it activated.
loadZData
:=
func
(
offset
int64
,
zd
*
ZData
)
error
{
err
:=
zd
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
err
}
// no PDeactivate
mu
.
Lock
()
defer
mu
.
Unlock
()
// XXX check dup keys?
chunktab
[
offset
]
=
zd
return
nil
}
// loadBucket loads all ZData objects from leaf BTree bucket.
loadBucket
:=
func
(
b
*
btree
.
Bucket
)
error
{
err
:=
b
.
PActivate
(
ctx
)
...
...
@@ -152,6 +170,16 @@ func (zb *ZBlk1) LoadBlkData(ctx context.Context) ([]byte, error) {
// XXX off < 0 !ok
// XXX off + len > blksize !ok
for
_
,
e
:=
range
b
.
Entryv
()
{
zd
,
ok
:=
e
.
Value
()
.
(
*
ZData
)
if
!
ok
{
return
fmt
.
Errorf
(
"!ZData (%T)"
,
e
.
Value
())
// XXX
}
wg
.
Go
(
func
()
error
{
return
loadZData
(
int64
(
e
.
Key
()),
zd
)
// XXX cast
})
}
return
nil
}
...
...
@@ -186,8 +214,20 @@ func (zb *ZBlk1) LoadBlkData(ctx context.Context) ([]byte, error) {
return
nil
}
loadBTree
(
zb
.
chunktab
)
// XXX err
wg
.
Go
(
func
()
error
{
return
loadBTree
(
zb
.
chunktab
)
})
err
:=
wg
.
Wait
()
// deactivate all loaded ZData objects in chunktab
for
_
,
zd
:=
range
chunktab
{
zd
.
PDeactivate
()
}
if
err
!=
nil
{
// XXX
}
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