Commit 6db32a78 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2b8a5115
...@@ -24,7 +24,6 @@ package zodb ...@@ -24,7 +24,6 @@ package zodb
import ( import (
"context" "context"
"fmt"
"sort" "sort"
"sync" "sync"
"time" "time"
...@@ -75,6 +74,23 @@ type ConnOptions struct { ...@@ -75,6 +74,23 @@ type ConnOptions struct {
NoSync bool // don't sync with storage to get its last tid. NoSync bool // don't sync with storage to get its last tid.
} }
// XXX place=?
func (opt *ConnOptions) String() string {
s := "(@"
if opt.At != 0 {
s += opt.At.String()
} else {
s += "head"
}
s += ", "
if opt.NoSync {
s += "no"
}
s += "sync)"
return s
}
// Open opens new connection to the database. // Open opens new connection to the database.
// //
// By default the connection is opened to current latest database state; opt.At // By default the connection is opened to current latest database state; opt.At
...@@ -89,18 +105,10 @@ func (db *DB) Open(ctx context.Context, opt *ConnOptions) (_ *Connection, err er ...@@ -89,18 +105,10 @@ func (db *DB) Open(ctx context.Context, opt *ConnOptions) (_ *Connection, err er
return return
} }
var argv []interface{}
if opt.At != 0 {
argv = append(argv, fmt.Sprintf("at=%s", opt.At))
}
if opt.NoSync {
argv = append(argv, "nosync")
}
err = &OpError{ err = &OpError{
URL: db.stor.URL(), URL: db.stor.URL(),
Op: "open db", Op: "open db",
Args: argv, Args: opt,
Err: err, Err: err,
} }
}() }()
...@@ -158,7 +166,7 @@ func (db *DB) get(at Tid) *Connection { ...@@ -158,7 +166,7 @@ func (db *DB) get(at Tid) *Connection {
}) })
// search through window of X previous connections and find out the one // search through window of X previous connections and find out the one
// with minimal distance to get to state @at. If all connections are to // with minimal distance to get to state @at. If all connections are too
// distant - create connection anew. // distant - create connection anew.
// //
// XXX search not only previous, but future too? (we can get back to // XXX search not only previous, but future too? (we can get back to
......
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