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
3baa5b34
Commit
3baa5b34
authored
Apr 09, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4ec86803
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
wcfs/zblk.go
wcfs/zblk.go
+9
-11
No files found.
wcfs/zblk.go
View file @
3baa5b34
...
...
@@ -20,7 +20,6 @@
package
main
// ZBlk* + ZBigFile loading
// module: "wendelin.bigfile.file_zodb"
//
// ZBigFile
...
...
@@ -44,13 +43,13 @@ import (
"sync"
"syscall"
"github.com/johncgriffin/overflow"
pickle
"github.com/kisielk/og-rek"
"lab.nexedi.com/kirr/go123/mem"
"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/btree"
pickle
"github.com/kisielk/og-rek"
"github.com/johncgriffin/overflow"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/pycompat"
)
...
...
@@ -308,7 +307,7 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) (_ []byte, _ zodb.Tid, err err
// glue all chunks from chunktab
offv
:=
make
([]
int32
,
0
,
len
(
chunktab
))
// ↑
for
off
:=
range
(
chunktab
)
{
for
off
:=
range
chunktab
{
offv
=
append
(
offv
,
off
)
}
sort
.
Slice
(
offv
,
func
(
i
,
j
int
)
bool
{
...
...
@@ -319,7 +318,7 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) (_ []byte, _ zodb.Tid, err err
//fmt.Printf("offv: %v\n", offv)
// find out whole blk len via inspecting tail chunk
// find out whole blk len via inspecting tail chunk
tailStart
:=
offv
[
len
(
offv
)
-
1
]
tailChunk
:=
chunktab
[
tailStart
]
blklen
,
ok
:=
overflow
.
Add32
(
tailStart
,
int32
(
len
(
tailChunk
.
data
)))
...
...
@@ -327,15 +326,15 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) (_ []byte, _ zodb.Tid, err err
return
nil
,
0
,
fmt
.
Errorf
(
"invalid data: blklen overflow"
)
}
// whole buffer initialized as 0 + tail_chunk
// whole buffer initialized as 0 + tail_chunk
blkdata
:=
make
([]
byte
,
blklen
)
copy
(
blkdata
[
tailStart
:
],
tailChunk
.
data
)
// go through all chunks besides tail and extract them
// go through all chunks besides tail and extract them
stop
:=
int32
(
0
)
for
_
,
start
:=
range
offv
[
:
len
(
offv
)
-
1
]
{
chunk
:=
chunktab
[
start
]
if
!
(
start
>=
stop
)
{
// verify chunks don't overlap
if
!
(
start
>=
stop
)
{
// verify chunks don't overlap
return
nil
,
0
,
fmt
.
Errorf
(
"invalid data: chunks overlap"
)
}
stop
,
ok
=
overflow
.
Add32
(
start
,
int32
(
len
(
chunk
.
data
)))
...
...
@@ -356,13 +355,12 @@ type ZBigFile struct {
zodb
.
Persistent
// state: (.blksize, .blktab)
blksize
int64
blktab
*
btree
.
LOBTree
// {} blk -> ZBlk*(blkdata)
blksize
int64
blktab
*
btree
.
LOBTree
// {} blk -> ZBlk*(blkdata)
}
type
zBigFileState
ZBigFile
// hide state methods from public API
// DropState implements zodb.Ghostable.
func
(
bf
*
zBigFileState
)
DropState
()
{
bf
.
blksize
=
0
...
...
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