Commit 0806740d authored by Kirill Smelkov's avatar Kirill Smelkov

go/zodb: Connection -= .stor

Connection has .db and db has .stor - there is no need to keep separate
.stor on the Connection. This thinko was there from Connection beginning
(533f0c73 "go/zodb: DB - application-level handle to database (very draft)")
parent 7e0c944f
...@@ -45,7 +45,6 @@ import ( ...@@ -45,7 +45,6 @@ import (
// //
// Use DB.Open to open a connection. // Use DB.Open to open a connection.
type Connection struct { type Connection struct {
stor IStorage // underlying storage
db *DB // Connection is part of this DB db *DB // Connection is part of this DB
txn transaction.Transaction // opened under this txn; nil if idle in DB pool. txn transaction.Transaction // opened under this txn; nil if idle in DB pool.
at Tid // current view of database; stable inside a transaction. at Tid // current view of database; stable inside a transaction.
...@@ -137,7 +136,6 @@ type LiveCacheControl interface { ...@@ -137,7 +136,6 @@ type LiveCacheControl interface {
// newConnection creates new Connection associated with db. // newConnection creates new Connection associated with db.
func newConnection(db *DB, at Tid) *Connection { func newConnection(db *DB, at Tid) *Connection {
return &Connection{ return &Connection{
stor: db.stor,
db: db, db: db,
at: at, at: at,
cache: LiveCache{ cache: LiveCache{
...@@ -262,7 +260,7 @@ func (conn *Connection) Get(ctx context.Context, oid Oid) (_ IPersistent, err er ...@@ -262,7 +260,7 @@ func (conn *Connection) Get(ctx context.Context, oid Oid) (_ IPersistent, err er
// load loads object specified by oid. // load loads object specified by oid.
func (conn *Connection) load(ctx context.Context, oid Oid) (_ *mem.Buf, serial Tid, _ error) { func (conn *Connection) load(ctx context.Context, oid Oid) (_ *mem.Buf, serial Tid, _ error) {
conn.checkTxnCtx(ctx, "load") conn.checkTxnCtx(ctx, "load")
return conn.stor.Load(ctx, Xid{Oid: oid, At: conn.at}) return conn.db.stor.Load(ctx, Xid{Oid: oid, At: conn.at})
} }
// ---------------------------------------- // ----------------------------------------
......
// Copyright (C) 2018 Nexedi SA and Contributors. // Copyright (C) 2018-2019 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your // it under the terms of the GNU General Public License version 3, or (at your
...@@ -74,7 +74,7 @@ func pySetState(obj PyStateful, objClass string, state *mem.Buf, jar *Connection ...@@ -74,7 +74,7 @@ func pySetState(obj PyStateful, objClass string, state *mem.Buf, jar *Connection
// It only returns decoded database data. // It only returns decoded database data.
func (conn *Connection) loadpy(ctx context.Context, oid Oid) (class string, pystate interface{}, serial Tid, _ error) { func (conn *Connection) loadpy(ctx context.Context, oid Oid) (class string, pystate interface{}, serial Tid, _ error) {
xid := Xid{Oid: oid, At: conn.at} xid := Xid{Oid: oid, At: conn.at}
buf, serial, err := conn.stor.Load(ctx, xid) buf, serial, err := conn.db.stor.Load(ctx, xid)
if err != nil { if err != nil {
return "", nil, 0, err return "", nil, 0, err
} }
...@@ -84,7 +84,7 @@ func (conn *Connection) loadpy(ctx context.Context, oid Oid) (class string, pyst ...@@ -84,7 +84,7 @@ func (conn *Connection) loadpy(ctx context.Context, oid Oid) (class string, pyst
pyclass, pystate, err := PyData(buf.Data).decode(conn) pyclass, pystate, err := PyData(buf.Data).decode(conn)
if err != nil { if err != nil {
err = &OpError{ err = &OpError{
URL: conn.stor.URL(), URL: conn.db.stor.URL(),
Op: "loadpy", Op: "loadpy",
Args: xid, Args: xid,
Err: err, Err: err,
......
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