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
e9f65d1d
Commit
e9f65d1d
authored
Feb 20, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f642592d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
go/zodb/db.go
go/zodb/db.go
+4
-3
go/zodb/persistent_test.go
go/zodb/persistent_test.go
+8
-8
No files found.
go/zodb/db.go
View file @
e9f65d1d
...
@@ -106,6 +106,7 @@ type DB struct {
...
@@ -106,6 +106,7 @@ type DB struct {
tδkeep
time
.
Duration
tδkeep
time
.
Duration
// openers waiting for δtail.Head to become covering their at.
// openers waiting for δtail.Head to become covering their at.
// XXX -> headWait?
δwait
map
[
δwaiter
]
struct
{}
// set{(at, ready)}
δwait
map
[
δwaiter
]
struct
{}
// set{(at, ready)}
// XXX δtail/δwait -> Storage. XXX or -> Cache? (so it is not duplicated many times for many DB case)
// XXX δtail/δwait -> Storage. XXX or -> Cache? (so it is not duplicated many times for many DB case)
...
@@ -185,7 +186,7 @@ func (db *DB) watcher(watchq <-chan Event) { // XXX err ?
...
@@ -185,7 +186,7 @@ func (db *DB) watcher(watchq <-chan Event) { // XXX err ?
return
// closed
return
// closed
}
}
fmt
.
Printf
(
"db: watcher <- %v
\n
"
,
event
)
//
fmt.Printf("db: watcher <- %v\n", event)
var
δ
*
EventCommit
var
δ
*
EventCommit
switch
event
:=
event
.
(
type
)
{
switch
event
:=
event
.
(
type
)
{
...
@@ -194,7 +195,7 @@ func (db *DB) watcher(watchq <-chan Event) { // XXX err ?
...
@@ -194,7 +195,7 @@ func (db *DB) watcher(watchq <-chan Event) { // XXX err ?
case
*
EventError
:
case
*
EventError
:
fmt
.
Printf
(
"db: watcher: error: %s
\n
"
,
event
.
Err
)
fmt
.
Printf
(
"db: watcher: error: %s
\n
"
,
event
.
Err
)
continue
// XXX shutdown instead
?
continue
// XXX shutdown instead
case
*
EventCommit
:
case
*
EventCommit
:
δ
=
event
δ
=
event
...
@@ -224,7 +225,7 @@ func (db *DB) watcher(watchq <-chan Event) { // XXX err ?
...
@@ -224,7 +225,7 @@ func (db *DB) watcher(watchq <-chan Event) { // XXX err ?
// wakeup waiters outside of db.mu
// wakeup waiters outside of db.mu
for
_
,
ready
:=
range
readyv
{
for
_
,
ready
:=
range
readyv
{
fmt
.
Printf
(
"db: watcher: wakeup %v
\n
"
,
ready
)
//
fmt.Printf("db: watcher: wakeup %v\n", ready)
close
(
ready
)
close
(
ready
)
}
}
}
}
...
...
go/zodb/persistent_test.go
View file @
e9f65d1d
...
@@ -80,7 +80,7 @@ func init() {
...
@@ -80,7 +80,7 @@ func init() {
// _checkObj verifies current state of persistent object.
// _checkObj verifies current state of persistent object.
//
//
// one can bind _checkObj to t via tCheckObj.
// one can bind _checkObj to t via tCheckObj.
func
_checkObj
(
t
testing
.
TB
,
obj
IPersistent
,
jar
*
Connection
,
oid
Oid
,
serial
Tid
,
state
ObjectState
,
refcnt
int32
,
loading
*
loadState
)
{
func
_checkObj
(
t
testing
.
TB
,
obj
IPersistent
,
jar
*
Connection
,
oid
Oid
,
serial
Tid
,
state
ObjectState
,
refcnt
int32
)
{
t
.
Helper
()
t
.
Helper
()
xbase
:=
reflect
.
ValueOf
(
obj
)
.
Elem
()
.
FieldByName
(
"Persistent"
)
xbase
:=
reflect
.
ValueOf
(
obj
)
.
Elem
()
.
FieldByName
(
"Persistent"
)
pbase
:=
xbase
.
Addr
()
.
Interface
()
.
(
*
Persistent
)
pbase
:=
xbase
.
Addr
()
.
Interface
()
.
(
*
Persistent
)
...
@@ -126,10 +126,10 @@ func _checkObj(t testing.TB, obj IPersistent, jar *Connection, oid Oid, serial T
...
@@ -126,10 +126,10 @@ func _checkObj(t testing.TB, obj IPersistent, jar *Connection, oid Oid, serial T
}
}
}
}
func
tCheckObj
(
t
testing
.
TB
)
func
(
IPersistent
,
*
Connection
,
Oid
,
Tid
,
ObjectState
,
int32
,
*
loadState
)
{
func
tCheckObj
(
t
testing
.
TB
)
func
(
IPersistent
,
*
Connection
,
Oid
,
Tid
,
ObjectState
,
int32
)
{
return
func
(
obj
IPersistent
,
jar
*
Connection
,
oid
Oid
,
serial
Tid
,
state
ObjectState
,
refcnt
int32
,
loading
*
loadState
)
{
return
func
(
obj
IPersistent
,
jar
*
Connection
,
oid
Oid
,
serial
Tid
,
state
ObjectState
,
refcnt
int32
)
{
t
.
Helper
()
t
.
Helper
()
_checkObj
(
t
,
obj
,
jar
,
oid
,
serial
,
state
,
refcnt
,
loading
)
_checkObj
(
t
,
obj
,
jar
,
oid
,
serial
,
state
,
refcnt
)
}
}
}
}
...
@@ -145,7 +145,7 @@ func TestPersistentBasic(t *testing.T) {
...
@@ -145,7 +145,7 @@ func TestPersistentBasic(t *testing.T) {
t
.
Fatalf
(
"unknown -> %T; want Broken"
,
xobj
)
t
.
Fatalf
(
"unknown -> %T; want Broken"
,
xobj
)
}
}
checkObj
(
b
,
nil
,
10
,
InvalidTid
,
GHOST
,
0
,
nil
)
checkObj
(
b
,
nil
,
10
,
InvalidTid
,
GHOST
,
0
)
assert
.
Equal
(
b
.
class
,
"t.unknown"
)
assert
.
Equal
(
b
.
class
,
"t.unknown"
)
assert
.
Equal
(
b
.
state
,
(
*
mem
.
Buf
)(
nil
))
assert
.
Equal
(
b
.
state
,
(
*
mem
.
Buf
)(
nil
))
...
@@ -157,7 +157,7 @@ func TestPersistentBasic(t *testing.T) {
...
@@ -157,7 +157,7 @@ func TestPersistentBasic(t *testing.T) {
t
.
Fatalf
(
"t.zodb.MyObject -> %T; want MyObject"
,
xobj
)
t
.
Fatalf
(
"t.zodb.MyObject -> %T; want MyObject"
,
xobj
)
}
}
checkObj
(
obj
,
nil
,
11
,
InvalidTid
,
GHOST
,
0
,
nil
)
checkObj
(
obj
,
nil
,
11
,
InvalidTid
,
GHOST
,
0
)
assert
.
Equal
(
ClassOf
(
obj
),
"t.zodb.MyObject"
)
assert
.
Equal
(
ClassOf
(
obj
),
"t.zodb.MyObject"
)
// t.zodb.MyOldObject -> *MyObject
// t.zodb.MyOldObject -> *MyObject
...
@@ -167,7 +167,7 @@ func TestPersistentBasic(t *testing.T) {
...
@@ -167,7 +167,7 @@ func TestPersistentBasic(t *testing.T) {
t
.
Fatalf
(
"t.zodb.MyOldObject -> %T; want MyObject"
,
xobj
)
t
.
Fatalf
(
"t.zodb.MyOldObject -> %T; want MyObject"
,
xobj
)
}
}
checkObj
(
obj
,
nil
,
12
,
InvalidTid
,
GHOST
,
0
,
nil
)
checkObj
(
obj
,
nil
,
12
,
InvalidTid
,
GHOST
,
0
)
assert
.
Equal
(
ClassOf
(
obj
),
"t.zodb.MyObject"
)
assert
.
Equal
(
ClassOf
(
obj
),
"t.zodb.MyObject"
)
// ClassOf(unregistered-obj)
// ClassOf(unregistered-obj)
...
@@ -251,7 +251,7 @@ func (t *tPersistentDB) checkObj(obj *MyObject, oid Oid, serial Tid, state Objec
...
@@ -251,7 +251,7 @@ func (t *tPersistentDB) checkObj(obj *MyObject, oid Oid, serial Tid, state Objec
t
.
Fatalf
(
"conn.get %s -> not same object:
\n
have: %#v
\n
want: %#v"
,
oid
,
connObj
,
oid
)
t
.
Fatalf
(
"conn.get %s -> not same object:
\n
have: %#v
\n
want: %#v"
,
oid
,
connObj
,
oid
)
}
}
_checkObj
(
t
.
T
,
obj
,
t
.
conn
,
oid
,
serial
,
state
,
refcnt
,
/*loading*/
nil
)
_checkObj
(
t
.
T
,
obj
,
t
.
conn
,
oid
,
serial
,
state
,
refcnt
)
if
state
==
GHOST
{
if
state
==
GHOST
{
if
len
(
valueOk
)
!=
0
{
if
len
(
valueOk
)
!=
0
{
...
...
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