Commit e9f65d1d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f642592d
...@@ -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)
} }
} }
......
...@@ -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:\nhave: %#v\nwant: %#v", oid, connObj, oid) t.Fatalf("conn.get %s -> not same object:\nhave: %#v\nwant: %#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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment