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
49581d4b
Commit
49581d4b
authored
Mar 17, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d731fd4e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
go/zodb/storage/demo/demo.go
go/zodb/storage/demo/demo.go
+15
-15
go/zodb/storage/demo/demo_test.go
go/zodb/storage/demo/demo_test.go
+2
-0
No files found.
go/zodb/storage/demo/demo.go
View file @
49581d4b
...
...
@@ -49,41 +49,41 @@ type Storage struct {
// Close implements zodb.IStorageDriver .
func
(
ovl
*
Storage
)
Close
()
error
{
// XXX ovl -> d ?
func
(
d
*
Storage
)
Close
()
error
{
// XXX errctx?
err1
:=
ovl
.
δ
.
Close
()
err2
:=
ovl
.
base
.
Close
()
err1
:=
d
.
δ
.
Close
()
err2
:=
d
.
base
.
Close
()
// XXX close base watcher
return
xerr
.
Merge
(
err1
,
err2
)
}
// Sync implements zodb.IStorageDriver .
func
(
ovl
*
Storage
)
Sync
(
ctx
context
.
Context
)
(
head
zodb
.
Tid
,
_
error
)
{
func
(
d
*
Storage
)
Sync
(
ctx
context
.
Context
)
(
head
zodb
.
Tid
,
_
error
)
{
// XXX errctx?
head
,
err
:=
ovl
.
δ
.
Sync
(
ctx
)
head
,
err
:=
d
.
δ
.
Sync
(
ctx
)
if
err
!=
nil
{
return
zodb
.
InvalidTid
,
err
}
// δ is just created database
if
head
==
0
{
head
=
ovl
.
baseAt0
head
=
d
.
baseAt0
}
return
head
,
nil
}
// Load implements zodb.IStorageDriver .
func
(
ovl
*
Storage
)
Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
_
*
mem
.
Buf
,
_
zodb
.
Tid
,
err
error
)
{
func
(
d
*
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
}
err
=
&
zodb
.
OpError
{
URL
:
d
.
URL
(),
Op
:
"load"
,
Args
:
xid
,
Err
:
err
}
}
}()
data
,
serial
,
err
:=
ovl
.
δ
.
Load
(
ctx
,
xid
)
data
,
serial
,
err
:=
d
.
δ
.
Load
(
ctx
,
xid
)
if
err
==
nil
{
// object data is present in δ
return
data
,
serial
,
nil
...
...
@@ -114,7 +114,7 @@ func (ovl *Storage) Load(ctx context.Context, xid zodb.Xid) (_ *mem.Buf, _ zodb.
}
// XXX cap .at in xid to base.At0 ? (and convert back on error return)
data
,
serial
,
err
=
ovl
.
base
.
Load
(
ctx
,
xid
)
data
,
serial
,
err
=
d
.
base
.
Load
(
ctx
,
xid
)
if
err
==
nil
{
return
data
,
serial
,
nil
}
...
...
@@ -135,14 +135,14 @@ func (ovl *Storage) Load(ctx context.Context, xid zodb.Xid) (_ *mem.Buf, _ zodb.
}
// Iterator implements zodb.IStorageDriver .
func
(
ovl
*
Storage
)
Iterate
(
ctx
context
.
Context
,
tidMin
,
tidMax
zodb
.
Tid
)
zodb
.
ITxnIterator
{
func
(
d
*
Storage
)
Iterate
(
ctx
context
.
Context
,
tidMin
,
tidMax
zodb
.
Tid
)
zodb
.
ITxnIterator
{
// XXX errctx?
panic
(
"TODO"
)
// XXX
}
// URL implements zodb.IStorageDriver .
func
(
ovl
*
Storage
)
URL
()
string
{
return
"demo:("
+
ovl
.
base
.
URL
()
+
")/("
+
ovl
.
δ
.
URL
()
+
")"
func
(
d
*
Storage
)
URL
()
string
{
return
"demo:("
+
d
.
base
.
URL
()
+
")/("
+
d
.
δ
.
URL
()
+
")"
}
var
demoRe
=
regexp
.
MustCompile
(
`^\((.*)\)/\((.*)\)$`
)
...
...
@@ -219,14 +219,14 @@ func openByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (_ zodb
}
// XXX listen on baseWatchq and shutdown storage if base changes.
ovl
:=
&
Storage
{
d
:=
&
Storage
{
base
:
base
,
δ
:
δ
,
baseAt0
:
baseAt0
,
}
return
ovl
,
at0
,
nil
return
d
,
at0
,
nil
}
func
init
()
{
...
...
go/zodb/storage/demo/demo_test.go
View file @
49581d4b
...
...
@@ -170,6 +170,8 @@ func TestWatch(t *testing.T) {
}
// TODO change base -> demo shutdown
func
demoOpen
(
zurl
string
,
opt
*
zodb
.
DriverOptions
)
(
_
*
Storage
,
at0
zodb
.
Tid
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"opendemo %s"
,
zurl
)
u
,
err
:=
url
.
Parse
(
zurl
)
...
...
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