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
1ea124ac
Commit
1ea124ac
authored
Jan 28, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
69e5d62a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
go/zodb/connection.go
go/zodb/connection.go
+3
-2
go/zodb/db.go
go/zodb/db.go
+10
-3
No files found.
go/zodb/connection.go
View file @
1ea124ac
...
@@ -46,10 +46,11 @@ import (
...
@@ -46,10 +46,11 @@ import (
// Use DB.Open to open a connection.
// Use DB.Open to open a connection.
type
Connection
struct
{
type
Connection
struct
{
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
after transaction ends
.
at
Tid
// current view of database; stable inside a transaction.
at
Tid
// current view of database; stable inside a transaction.
cache
LiveCache
// cache of connection's in-RAM objects
cache
LiveCache
// cache of connection's in-RAM objects
noPool
bool
// connection is not returned to db.pool
}
}
// LiveCache keeps registry of live in-RAM objects for a Connection.
// LiveCache keeps registry of live in-RAM objects for a Connection.
...
...
go/zodb/db.go
View file @
1ea124ac
...
@@ -216,7 +216,7 @@ func (db *DB) watcher(watchq <-chan CommitEvent) { // XXX err ?
...
@@ -216,7 +216,7 @@ func (db *DB) watcher(watchq <-chan CommitEvent) { // XXX err ?
// Opened connection must be used only under the same transaction and only
// Opened connection must be used only under the same transaction and only
// until that transaction is complete(*).
// until that transaction is complete(*).
//
//
// (*)
XXX
unless NoPool option is used.
// (*) unless NoPool option is used.
func
(
db
*
DB
)
Open
(
ctx
context
.
Context
,
opt
*
ConnOptions
)
(
_
*
Connection
,
err
error
)
{
func
(
db
*
DB
)
Open
(
ctx
context
.
Context
,
opt
*
ConnOptions
)
(
_
*
Connection
,
err
error
)
{
defer
func
()
{
defer
func
()
{
if
err
==
nil
{
if
err
==
nil
{
...
@@ -261,10 +261,17 @@ func (db *DB) Open(ctx context.Context, opt *ConnOptions) (_ *Connection, err er
...
@@ -261,10 +261,17 @@ func (db *DB) Open(ctx context.Context, opt *ConnOptions) (_ *Connection, err er
at
=
head
at
=
head
}
}
// XXX
var
conn
*
Connection
if
opt
.
NoPool
{
conn
=
newConnection
(
db
,
at
)
conn
.
noPool
=
true
}
db
.
mu
.
Lock
()
db
.
mu
.
Lock
()
// check if we already have the exact match
// check if we already have the exact match
conn
:
=
db
.
get
(
at
,
at
)
conn
=
db
.
get
(
at
,
at
)
if
conn
==
nil
{
if
conn
==
nil
{
δtail
:=
db
.
δtail
// XXX
δtail
:=
db
.
δtail
// XXX
...
@@ -446,7 +453,7 @@ func (csync *connTxnSync) AfterCompletion(txn transaction.Transaction) {
...
@@ -446,7 +453,7 @@ func (csync *connTxnSync) AfterCompletion(txn transaction.Transaction) {
// mark the connection as no longer being live
// mark the connection as no longer being live
conn
.
txn
=
nil
conn
.
txn
=
nil
if
!
conn
.
flags
&
noPool
{
if
!
conn
.
noPool
{
conn
.
db
.
put
(
conn
)
conn
.
db
.
put
(
conn
)
}
}
}
}
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