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
2
Merge Requests
2
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
e9f65d1d
Commit
e9f65d1d
authored
Feb 20, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f642592d
Changes
2
Show 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 {
tδkeep
time
.
Duration
// openers waiting for δtail.Head to become covering their at.
// XXX -> headWait?
δ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)
...
...
@@ -185,7 +186,7 @@ func (db *DB) watcher(watchq <-chan Event) { // XXX err ?
return
// closed
}
fmt
.
Printf
(
"db: watcher <- %v
\n
"
,
event
)
//
fmt.Printf("db: watcher <- %v\n", event)
var
δ
*
EventCommit
switch
event
:=
event
.
(
type
)
{
...
...
@@ -194,7 +195,7 @@ func (db *DB) watcher(watchq <-chan Event) { // XXX err ?
case
*
EventError
:
fmt
.
Printf
(
"db: watcher: error: %s
\n
"
,
event
.
Err
)
continue
// XXX shutdown instead
?
continue
// XXX shutdown instead
case
*
EventCommit
:
δ
=
event
...
...
@@ -224,7 +225,7 @@ func (db *DB) watcher(watchq <-chan Event) { // XXX err ?
// wakeup waiters outside of db.mu
for
_
,
ready
:=
range
readyv
{
fmt
.
Printf
(
"db: watcher: wakeup %v
\n
"
,
ready
)
//
fmt.Printf("db: watcher: wakeup %v\n", ready)
close
(
ready
)
}
}
...
...
go/zodb/persistent_test.go
View file @
e9f65d1d
...
...
@@ -80,7 +80,7 @@ func init() {
// _checkObj verifies current state of persistent object.
//
// 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
()
xbase
:=
reflect
.
ValueOf
(
obj
)
.
Elem
()
.
FieldByName
(
"Persistent"
)
pbase
:=
xbase
.
Addr
()
.
Interface
()
.
(
*
Persistent
)
...
...
@@ -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
)
{
return
func
(
obj
IPersistent
,
jar
*
Connection
,
oid
Oid
,
serial
Tid
,
state
ObjectState
,
refcnt
int32
,
loading
*
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
)
{
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) {
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
.
state
,
(
*
mem
.
Buf
)(
nil
))
...
...
@@ -157,7 +157,7 @@ func TestPersistentBasic(t *testing.T) {
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"
)
// t.zodb.MyOldObject -> *MyObject
...
...
@@ -167,7 +167,7 @@ func TestPersistentBasic(t *testing.T) {
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"
)
// ClassOf(unregistered-obj)
...
...
@@ -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
)
}
_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
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