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
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
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
...
@@ -283,7 +283,6 @@ func (fs *FileStorage) Load(_ context.Context, xid zodb.Xid) (data *zodb.Buf, ti
// be of first-found transaction
// be of first-found transaction
tid
=
dh
.
Tid
tid
=
dh
.
Tid
// TODO data -> slab
data
,
err
=
dh
.
LoadData
(
fs
.
file
)
data
,
err
=
dh
.
LoadData
(
fs
.
file
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
&
ErrXidLoad
{
xid
,
err
}
return
nil
,
0
,
&
ErrXidLoad
{
xid
,
err
}
...
@@ -315,7 +314,7 @@ type zIter struct {
...
@@ -315,7 +314,7 @@ type zIter struct {
dhLoading
DataHeader
dhLoading
DataHeader
sri
zodb
.
StorageRecordInformation
// ptr to this will be returned by .NextData
sri
zodb
.
StorageRecordInformation
// ptr to this will be returned by .NextData
dataBuf
[]
byte
dataBuf
*
zodb
.
Buf
}
}
type
zIterFlags
int
type
zIterFlags
int
...
@@ -369,17 +368,22 @@ func (zi *zIter) NextData() (*zodb.StorageRecordInformation, error) {
...
@@ -369,17 +368,22 @@ func (zi *zIter) NextData() (*zodb.StorageRecordInformation, error) {
// NOTE dh.LoadData() changes dh state while going through backpointers -
// NOTE dh.LoadData() changes dh state while going through backpointers -
// - need to use separate dh because of this
// - need to use separate dh because of this
zi
.
dhLoading
=
zi
.
iter
.
Datah
zi
.
dhLoading
=
zi
.
iter
.
Datah
zi
.
sri
.
Data
=
zi
.
dataBuf
if
zi
.
dataBuf
!=
nil
{
err
=
zi
.
dhLoading
.
LoadData
(
zi
.
iter
.
R
,
&
zi
.
sri
.
Data
)
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
{
if
err
!=
nil
{
return
nil
,
err
// XXX recheck
return
nil
,
err
// XXX recheck
}
}
// if memory was reallocated - use it next time
//
// if memory was reallocated - use it next time
if
cap
(
zi
.
sri
.
Data
)
>
cap
(
zi
.
dataBuf
)
{
//
if cap(zi.sri.Data) > cap(zi.dataBuf) {
zi
.
dataBuf
=
zi
.
sri
.
Data
//
zi.dataBuf = zi.sri.Data
}
//
}
zi
.
sri
.
Data
=
zi
.
dataBuf
.
Data
zi
.
sri
.
DataTid
=
zi
.
dhLoading
.
Tid
zi
.
sri
.
DataTid
=
zi
.
dhLoading
.
Tid
return
&
zi
.
sri
,
nil
return
&
zi
.
sri
,
nil
}
}
...
...
go/zodb/storage/fs1/filestorage_test.go
View file @
75a9a26b
...
@@ -75,15 +75,15 @@ type oidLoadedOk struct {
...
@@ -75,15 +75,15 @@ type oidLoadedOk struct {
// checkLoad verifies that fs.Load(xid) returns expected result
// checkLoad verifies that fs.Load(xid) returns expected result
func
checkLoad
(
t
*
testing
.
T
,
fs
*
FileStorage
,
xid
zodb
.
Xid
,
expect
oidLoadedOk
)
{
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
{
if
err
!=
nil
{
t
.
Errorf
(
"load %v: %v"
,
xid
,
err
)
t
.
Errorf
(
"load %v: %v"
,
xid
,
err
)
}
}
if
tid
!=
expect
.
tid
{
if
tid
!=
expect
.
tid
{
t
.
Errorf
(
"load %v: returned tid unexpected: %v ; want: %v"
,
xid
,
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 != ""
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
,
d
ata
,
expect
.
data
)
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 {
...
@@ -132,7 +132,7 @@ type DumperFsDump struct {
// for loading data
// for loading data
dhLoading
fs1
.
DataHeader
dhLoading
fs1
.
DataHeader
data
[]
byte
//
data []byte
}
}
func
(
d
*
DumperFsDump
)
DumperName
()
string
{
func
(
d
*
DumperFsDump
)
DumperName
()
string
{
...
@@ -174,30 +174,30 @@ func (d *DumperFsDump) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
...
@@ -174,30 +174,30 @@ func (d *DumperFsDump) DumpTxn(buf *xfmt.Buffer, it *fs1.Iter) error {
// load actual data
// load actual data
d
.
dhLoading
=
*
dh
d
.
dhLoading
=
*
dh
data
:=
d
.
data
dataBuf
,
err
:=
d
.
dhLoading
.
LoadData
(
it
.
R
)
err
=
d
.
dhLoading
.
LoadData
(
it
.
R
,
&
data
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
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"
)
buf
.
S
(
" class=undo or abort of object creation"
)
}
else
{
}
else
{
fullclass
:=
zodb
.
PyData
(
data
)
.
ClassName
()
fullclass
:=
zodb
.
PyData
(
data
Buf
.
Data
)
.
ClassName
()
buf
.
S
(
" size="
)
.
D64
(
d
.
dhLoading
.
DataLen
)
buf
.
S
(
" size="
)
.
D64
(
d
.
dhLoading
.
DataLen
)
buf
.
S
(
" class="
)
.
S
(
fullclass
)
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
// it was backpointer - print tid of transaction it points to
buf
.
S
(
" bp="
)
.
V
(
d
.
dhLoading
.
Tid
)
buf
.
S
(
" bp="
)
.
V
(
d
.
dhLoading
.
Tid
)
}
}
// XXX avoid `if != nil`
if
dataBuf
!=
nil
{
dataBuf
.
Free
()
}
buf
.
S
(
"
\n
"
)
buf
.
S
(
"
\n
"
)
}
}
...
...
go/zodb/zodb.go
View file @
75a9a26b
...
@@ -156,7 +156,7 @@ type IStorage interface {
...
@@ -156,7 +156,7 @@ type IStorage interface {
//
//
// XXX zodb.loadBefore() returns (data, serial, serial_next) -> add serial_next?
// 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
// TODO specify error when data not found -> ErrOidMissing | ErrXidMissing
Load
(
ctx
context
.
Context
,
xid
Xid
)
(
data
*
Buf
,
serial
Tid
,
err
error
)
// XXX -> StorageRecordInformation ?
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