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
6ae2604b
Commit
6ae2604b
authored
Dec 18, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X zodb: Clarify load semantic: for deleted data err="no data" and buf, serial = nil, 0
parent
75dc3060
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
go/zodb/storage/cache_test.go
go/zodb/storage/cache_test.go
+3
-2
go/zodb/storage/fs1/filestorage.go
go/zodb/storage/fs1/filestorage.go
+6
-6
go/zodb/storage/fs1/format.go
go/zodb/storage/fs1/format.go
+1
-1
go/zodb/zodb.go
go/zodb/zodb.go
+0
-1
No files found.
go/zodb/storage/cache_test.go
View file @
6ae2604b
...
@@ -89,10 +89,11 @@ func (stor *tStorage) Load(_ context.Context, xid zodb.Xid) (buf *zodb.Buf, seri
...
@@ -89,10 +89,11 @@ func (stor *tStorage) Load(_ context.Context, xid zodb.Xid) (buf *zodb.Buf, seri
}
}
s
,
e
:=
datav
[
i
]
.
serial
,
datav
[
i
]
.
err
s
,
e
:=
datav
[
i
]
.
serial
,
datav
[
i
]
.
err
b
:=
mkbuf
(
datav
[
i
]
.
data
)
if
e
!=
nil
{
if
e
!=
nil
{
s
=
0
// obey protocol of returning
0 with error
b
,
s
=
nil
,
0
// obey protocol of returning nil,
0 with error
}
}
return
mkbuf
(
datav
[
i
]
.
data
)
,
s
,
e
return
b
,
s
,
e
}
}
var
ioerr
=
errors
.
New
(
"input/output error"
)
var
ioerr
=
errors
.
New
(
"input/output error"
)
...
...
go/zodb/storage/fs1/filestorage.go
View file @
6ae2604b
...
@@ -146,7 +146,7 @@ func (dh *DataHeader) Free() {
...
@@ -146,7 +146,7 @@ func (dh *DataHeader) Free() {
dhPool
.
Put
(
dh
)
dhPool
.
Put
(
dh
)
}
}
func
(
fs
*
FileStorage
)
Load
(
_
context
.
Context
,
xid
zodb
.
Xid
)
(
buf
*
zodb
.
Buf
,
tid
zodb
.
Tid
,
err
error
)
{
func
(
fs
*
FileStorage
)
Load
(
_
context
.
Context
,
xid
zodb
.
Xid
)
(
buf
*
zodb
.
Buf
,
serial
zodb
.
Tid
,
err
error
)
{
// lookup in index position of oid data record within latest transaction which changed this oid
// lookup in index position of oid data record within latest transaction which changed this oid
dataPos
,
ok
:=
fs
.
index
.
Get
(
xid
.
Oid
)
dataPos
,
ok
:=
fs
.
index
.
Get
(
xid
.
Oid
)
if
!
ok
{
if
!
ok
{
...
@@ -162,9 +162,9 @@ func (fs *FileStorage) Load(_ context.Context, xid zodb.Xid) (buf *zodb.Buf, tid
...
@@ -162,9 +162,9 @@ func (fs *FileStorage) Load(_ context.Context, xid zodb.Xid) (buf *zodb.Buf, tid
dh
.
Tid
=
zodb
.
TidMax
dh
.
Tid
=
zodb
.
TidMax
dh
.
PrevRevPos
=
dataPos
dh
.
PrevRevPos
=
dataPos
//defer dh.Free()
//defer dh.Free()
buf
,
tid
,
err
=
fs
.
_Load
(
dh
,
xid
)
buf
,
serial
,
err
=
fs
.
_Load
(
dh
,
xid
)
dh
.
Free
()
dh
.
Free
()
return
buf
,
tid
,
err
return
buf
,
serial
,
err
}
}
func
(
fs
*
FileStorage
)
_Load
(
dh
*
DataHeader
,
xid
zodb
.
Xid
)
(
*
zodb
.
Buf
,
zodb
.
Tid
,
error
)
{
func
(
fs
*
FileStorage
)
_Load
(
dh
*
DataHeader
,
xid
zodb
.
Xid
)
(
*
zodb
.
Buf
,
zodb
.
Tid
,
error
)
{
...
@@ -187,9 +187,9 @@ func (fs *FileStorage) _Load(dh *DataHeader, xid zodb.Xid) (*zodb.Buf, zodb.Tid,
...
@@ -187,9 +187,9 @@ func (fs *FileStorage) _Load(dh *DataHeader, xid zodb.Xid) (*zodb.Buf, zodb.Tid,
}
}
}
}
// even if we will scan back via backpointers, the
tid
returned should
// even if we will scan back via backpointers, the
serial
returned should
// be of first-found transaction
// be of first-found transaction
tid
:=
dh
.
Tid
serial
:=
dh
.
Tid
buf
,
err
:=
dh
.
LoadData
(
fs
.
file
)
buf
,
err
:=
dh
.
LoadData
(
fs
.
file
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -200,7 +200,7 @@ func (fs *FileStorage) _Load(dh *DataHeader, xid zodb.Xid) (*zodb.Buf, zodb.Tid,
...
@@ -200,7 +200,7 @@ func (fs *FileStorage) _Load(dh *DataHeader, xid zodb.Xid) (*zodb.Buf, zodb.Tid,
return
nil
,
0
,
&
zodb
.
ErrXidMissing
{
Xid
:
xid
}
return
nil
,
0
,
&
zodb
.
ErrXidMissing
{
Xid
:
xid
}
}
}
return
buf
,
tid
,
nil
return
buf
,
serial
,
nil
}
}
// --- ZODB-level iteration ---
// --- ZODB-level iteration ---
...
...
go/zodb/storage/fs1/format.go
View file @
6ae2604b
...
@@ -657,7 +657,7 @@ func (dh *DataHeader) loadNext(r io.ReaderAt, txnh *TxnHeader) error {
...
@@ -657,7 +657,7 @@ func (dh *DataHeader) loadNext(r io.ReaderAt, txnh *TxnHeader) error {
// LoadData loads data for the data record taking backpointers into account.
// LoadData loads data for the data record taking backpointers into account.
//
//
// NOTE on success dh state is changed to data header of original data transaction.
// NOTE on success dh state is changed to data header of original data transaction.
// NOTE "deleted" records are indicated via returning buf with .Data=nil.
// NOTE "deleted" records are indicated via returning buf with .Data=nil
without error
.
func
(
dh
*
DataHeader
)
LoadData
(
r
io
.
ReaderAt
)
(
*
zodb
.
Buf
,
error
)
{
func
(
dh
*
DataHeader
)
LoadData
(
r
io
.
ReaderAt
)
(
*
zodb
.
Buf
,
error
)
{
// scan via backpointers
// scan via backpointers
for
dh
.
DataLen
==
0
{
for
dh
.
DataLen
==
0
{
...
...
go/zodb/zodb.go
View file @
6ae2604b
...
@@ -160,7 +160,6 @@ type IStorage interface {
...
@@ -160,7 +160,6 @@ type IStorage interface {
// Load loads object data addressed by xid from database.
// Load loads object data addressed by xid from database.
//
//
// XXX currently deleted data is returned as buf.Data=nil -- is it ok?
// TODO specify error when data not found -> ErrOidMissing | ErrXidMissing
// TODO specify error when data not found -> ErrOidMissing | ErrXidMissing
//
//
// NOTE ZODB/py provides 2 entrypoints in IStorage for loading:
// NOTE ZODB/py provides 2 entrypoints in IStorage for loading:
...
...
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