Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
cc960283
Commit
cc960283
authored
3 years ago
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a3cb9f32
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
go/zodb/storage/demo/demo.go
go/zodb/storage/demo/demo.go
+21
-6
No files found.
go/zodb/storage/demo/demo.go
View file @
cc960283
...
...
@@ -49,7 +49,7 @@ type Storage struct {
// Close implements zodb.IStorageDriver .
func
(
ovl
*
Storage
)
Close
()
error
{
func
(
ovl
*
Storage
)
Close
()
error
{
// XXX ovl -> d ?
// XXX errctx?
err1
:=
ovl
.
δ
.
Close
()
...
...
@@ -76,13 +76,17 @@ func (ovl *Storage) Sync(ctx context.Context) (head zodb.Tid, _ error) {
}
// Load implements zodb.IStorageDriver .
func
(
ovl
*
Storage
)
Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
*
mem
.
Buf
,
zodb
.
Tid
,
error
)
{
// XXX errctx?
func
(
ovl
*
Storage
)
Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
_
*
mem
.
Buf
,
_
zodb
.
Tid
,
err
error
)
{
defer
func
()
{
if
err
!=
nil
{
err
=
&
zodb
.
OpError
{
URL
:
ovl
.
URL
(),
Op
:
"load"
,
Args
:
xid
,
Err
:
err
}
}
}()
data
,
serial
,
err
:=
ovl
.
δ
.
Load
(
ctx
,
xid
)
if
data
!
=
nil
{
if
err
=
=
nil
{
// object data is present in δ
return
data
,
serial
,
err
return
data
,
serial
,
nil
}
useBase
:=
false
...
...
@@ -92,7 +96,7 @@ func (ovl *Storage) Load(ctx context.Context, xid zodb.Xid) (*mem.Buf, zodb.Tid,
case
errors
.
As
(
err
,
&
eNoData
)
:
if
eNoData
.
DeletedAt
!=
0
{
// object deleted in δ -> whiteout
return
data
,
serial
,
e
rr
return
data
,
serial
,
e
NoData
}
else
{
// object not created in δ
useBase
=
true
...
...
@@ -109,6 +113,17 @@ func (ovl *Storage) Load(ctx context.Context, xid zodb.Xid) (*mem.Buf, zodb.Tid,
// XXX cap .at in xid to base.At0 ? (and convert back on error return)
data
,
serial
,
err
=
ovl
.
base
.
Load
(
ctx
,
xid
)
if
err
==
nil
{
return
data
,
serial
,
nil
}
switch
{
case
errors
.
As
(
err
,
&
eNoData
)
:
err
=
eNoData
case
errors
.
As
(
err
,
&
eNoObject
)
:
err
=
eNoObject
}
return
data
,
serial
,
err
}
...
...
This diff is collapsed.
Click to expand it.
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