Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
75a9a26b
Commit
75a9a26b
authored
Sep 11, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
de0d5028
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
22 deletions
+26
-22
go/zodb/storage/fs1/filestorage.go
go/zodb/storage/fs1/filestorage.go
+12
-8
go/zodb/storage/fs1/filestorage_test.go
go/zodb/storage/fs1/filestorage_test.go
+3
-3
go/zodb/storage/fs1/fs1tools/dump.go
go/zodb/storage/fs1/fs1tools/dump.go
+10
-10
go/zodb/zodb.go
go/zodb/zodb.go
+1
-1
No files found.
go/zodb/storage/fs1/filestorage.go
View file @
75a9a26b
...
...
@@ -283,7 +283,6 @@ func (fs *FileStorage) Load(_ context.Context, xid zodb.Xid) (data *zodb.Buf, ti
// be of first-found transaction
tid
=
dh
.
Tid
// TODO data -> slab
data
,
err
=
dh
.
LoadData
(
fs
.
file
)
if
err
!=
nil
{
return
nil
,
0
,
&
ErrXidLoad
{
xid
,
err
}
...
...
@@ -315,7 +314,7 @@ type zIter struct {
dhLoading
DataHeader
sri
zodb
.
StorageRecordInformation
// ptr to this will be returned by .NextData
dataBuf
[]
byte
dataBuf
*
zodb
.
Buf
}
type
zIterFlags
int
...
...
@@ -369,17 +368,22 @@ func (zi *zIter) NextData() (*zodb.StorageRecordInformation, error) {
// NOTE dh.LoadData() changes dh state while going through backpointers -
// - need to use separate dh because of this
zi
.
dhLoading
=
zi
.
iter
.
Datah
zi
.
sri
.
Data
=
zi
.
dataBuf
err
=
zi
.
dhLoading
.
LoadData
(
zi
.
iter
.
R
,
&
zi
.
sri
.
Data
)
if
zi
.
dataBuf
!=
nil
{
zi
.
dataBuf
.
Free
()
zi
.
dataBuf
=
nil
}
// zi.sri.Data = zi.dataBuf
zi
.
dataBuf
,
err
=
zi
.
dhLoading
.
LoadData
(
zi
.
iter
.
R
)
//, &zi.sri.Data)
if
err
!=
nil
{
return
nil
,
err
// XXX recheck
}
// if memory was reallocated - use it next time
if
cap
(
zi
.
sri
.
Data
)
>
cap
(
zi
.
dataBuf
)
{
zi
.
dataBuf
=
zi
.
sri
.
Data
}
//
// if memory was reallocated - use it next time
//
if cap(zi.sri.Data) > cap(zi.dataBuf) {
//
zi.dataBuf = zi.sri.Data
//
}
zi
.
sri
.
Data
=
zi
.
dataBuf
.
Data
zi
.
sri
.
DataTid
=
zi
.
dhLoading
.
Tid
return
&
zi
.
sri
,
nil
}
...
...
go/zodb/storage/fs1/filestorage_test.go
View file @
75a9a26b
...
...
@@ -75,15 +75,15 @@ type oidLoadedOk struct {
// checkLoad verifies that fs.Load(xid) returns expected result
func
checkLoad
(
t
*
testing
.
T
,
fs
*
FileStorage
,
xid
zodb
.
Xid
,
expect
oidLoadedOk
)
{
data
,
tid
,
err
:=
fs
.
Load
(
context
.
Background
(),
xid
)
buf
,
tid
,
err
:=
fs
.
Load
(
context
.
Background
(),
xid
)
if
err
!=
nil
{
t
.
Errorf
(
"load %v: %v"
,
xid
,
err
)
}
if
tid
!=
expect
.
tid
{
t
.
Errorf
(
"load %v: returned tid unexpected: %v ; want: %v"
,
xid
,
tid
,
expect
.
tid
)
}
if
!
reflect
.
DeepEqual
(
d
ata
,
expect
.
data
)
{
// NOTE reflect to catch nil != ""
t
.
Errorf
(
"load %v: different data:
\n
have: %q
\n
want: %q"
,
xid
,
d
ata
,
expect
.
data
)
if
!
reflect
.
DeepEqual
(
buf
.
D
ata
,
expect
.
data
)
{
// NOTE reflect to catch nil != ""
t
.
Errorf
(
"load %v: different data:
\n
have: %q
\n
want: %q"
,
xid
,
buf
.
D
ata
,
expect
.
data
)
}
}
...
...
go/zodb/storage/fs1/fs1tools/dump.go
View file @
75a9a26b
...
...
@@ -132,7 +132,7 @@ type DumperFsDump struct {
// for loading data
dhLoading
fs1
.
DataHeader
data
[]
byte
//
data []byte
}
func
(
d
*
DumperFsDump
)
DumperName
()
string
{
...
...
@@ -174,30 +174,30 @@ func (d *DumperFsDump) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
// load actual data
d
.
dhLoading
=
*
dh
data
:=
d
.
data
err
=
d
.
dhLoading
.
LoadData
(
it
.
R
,
&
data
)
dataBuf
,
err
:=
d
.
dhLoading
.
LoadData
(
it
.
R
)
if
err
!=
nil
{
return
err
}
// if memory was reallocated - use it next time
if
cap
(
data
)
>
cap
(
d
.
data
)
{
d
.
data
=
data
}
if
data
==
nil
{
if
data
Buf
==
nil
{
buf
.
S
(
" class=undo or abort of object creation"
)
}
else
{
fullclass
:=
zodb
.
PyData
(
data
)
.
ClassName
()
fullclass
:=
zodb
.
PyData
(
data
Buf
.
Data
)
.
ClassName
()
buf
.
S
(
" size="
)
.
D64
(
d
.
dhLoading
.
DataLen
)
buf
.
S
(
" class="
)
.
S
(
fullclass
)
}
if
dh
.
DataLen
==
0
&&
data
!=
nil
{
if
dh
.
DataLen
==
0
&&
data
Buf
!=
nil
{
// it was backpointer - print tid of transaction it points to
buf
.
S
(
" bp="
)
.
V
(
d
.
dhLoading
.
Tid
)
}
// XXX avoid `if != nil`
if
dataBuf
!=
nil
{
dataBuf
.
Free
()
}
buf
.
S
(
"
\n
"
)
}
...
...
go/zodb/zodb.go
View file @
75a9a26b
...
...
@@ -156,7 +156,7 @@ type IStorage interface {
//
// XXX zodb.loadBefore() returns (data, serial, serial_next) -> add serial_next?
//
// XXX currently deleted data is returned as data=nil -- is it ok?
// XXX currently deleted data is returned as data
.Data
=nil -- is it ok?
// TODO specify error when data not found -> ErrOidMissing | ErrXidMissing
Load
(
ctx
context
.
Context
,
xid
Xid
)
(
data
*
Buf
,
serial
Tid
,
err
error
)
// XXX -> StorageRecordInformation ?
...
...
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