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
a55a9258
Commit
a55a9258
authored
Jan 28, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0d6b8ad3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
go/zodb/db.go
go/zodb/db.go
+25
-12
No files found.
go/zodb/db.go
View file @
a55a9258
...
...
@@ -349,20 +349,33 @@ func (db *DB) Open(ctx context.Context, opt *ConnOptions) (_ *Connection, err er
return
conn
,
nil
}
// Resync resyncs the connection onto different database view.
// Resync resyncs the connection onto different database view
and transaction
.
//
// XXX previous conn's txn must be already complete.
// XXX must be run under transaction.
// XXX objects are guaranteed to stay in live cache, even if in ghost state.
// XXX Resync allowed only for connections opened with NoPool flag.
// XXX contrary to DB.Open at cannot be 0.
// XXX new at can be both higher and lower than previous at.
func
(
conn
*
Connection
)
Resync
(
ctx
context
.
Context
,
at
Tid
)
{
// XXX assert conn.noPool == true
// XXX assert conn.txn == nil
// XXX assert at != 0
// Connection objects pinned in live cache are guaranteed to stay in live
// cache, even if maybe in ghost state (e.g. if they have to be invalidated due
// to database changes).
//
// Resync can be used several times.
//
// Resync must be used only under the following conditions:
//
// - the connection was initially opened with NoPool flag.
// - previous transaction, under which connection was previously
// opened/resynced, must be already complete.
// - contrary to DB.Open, at cannot be 0.
//
// Note: new at can be both higher and lower than previous connection at.
func
(
conn
*
Connection
)
Resync
(
txn
transaction
.
Transaction
,
at
Tid
)
{
if
!
conn
.
noPool
{
panic
(
"Conn.Resync: connection was opened without NoPool flag"
)
}
if
conn
.
txn
!=
nil
{
panic
(
"Conn.Resync: previous transaction is not yet complete"
)
}
if
at
==
0
{
panic
(
"Conn.Resync: resync to at=0 (auto-mode is valid only for DB.Open)"
)
}
// XXX conn.cache.Lock ? - yes (e.g. if user also checks it from outside, right?)
txn
:=
transaction
.
Current
(
ctx
)
db
:=
conn
.
db
db
.
mu
.
Lock
()
...
...
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