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
a520c82e
Commit
a520c82e
authored
Aug 08, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f7b570c2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
12 deletions
+26
-12
go/zodb/btree/btree_test.go
go/zodb/btree/btree_test.go
+1
-1
go/zodb/db.go
go/zodb/db.go
+25
-11
No files found.
go/zodb/btree/btree_test.go
View file @
a520c82e
...
...
@@ -67,7 +67,7 @@ func TestBTree(t *testing.T) {
txn
,
ctx
:=
transaction
.
New
(
ctx
)
defer
txn
.
Abort
()
conn
,
err
:=
db
.
Open
(
ctx
)
conn
,
err
:=
db
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{}
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
go/zodb/db.go
View file @
a520c82e
...
...
@@ -67,28 +67,42 @@ func NewDB(stor IStorage) *DB {
return
&
DB
{
stor
:
stor
}
}
// ConnOptions describes options to DB.Open .
type
ConnOptions
struct
{
At
Tid
// if !0, open Connection bound to `at` view of database; not latest.
NoSync
bool
// don't sync with storage to get its last tid.
}
// Open opens new connection to the database.
//
// The connection is opened to current latest database state.
// By default the connection is opened to current latest database state; opt.At
// can be specified to open connection bound to particular view of the database.
//
// Open must be called under transaction.
// Opened connection must be used only under the same transaction and only
// until that transaction is complete.
//
// XXX text
//
// XXX +OpenAt ?
func
(
db
*
DB
)
Open
(
ctx
context
.
Context
)
(
*
Connection
,
error
)
{
func
(
db
*
DB
)
Open
(
ctx
context
.
Context
,
opt
*
ConnOptions
)
(
*
Connection
,
error
)
{
// XXX err ctx
txn
:=
transaction
.
Current
(
ctx
)
at
:=
opt
.
At
if
at
==
0
{
// XXX init head from current DB.head (head of .invTab)
var
head
Tid
var
err
error
// sync storage for lastTid
// XXX open option not to sync and just get lastTid as .invTab.Head() ?
at
,
err
:
=
db
.
stor
.
LastTid
(
ctx
)
if
!
opt
.
NoSync
{
head
,
err
=
db
.
stor
.
LastTid
(
ctx
)
if
err
!=
nil
{
return
nil
,
err
}
}
at
=
head
}
// wait till .invTab is up to date covering ≥ lastTid
// XXX reenable
...
...
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