Commit f951b01c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8e84ac9e
...@@ -443,41 +443,19 @@ func (c *Client) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator { ...@@ -443,41 +443,19 @@ func (c *Client) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
// TODO read-only support // TODO read-only support
func openClientByURL(ctx context.Context, u *url.URL) (zodb.IStorage, error) { func openClientByURL(ctx context.Context, u *url.URL) (zodb.IStorage, error) {
// XXX u.Host -> masterAddr (not storage) // neo://name@master1,master2,...,masterN?options
panic("TODO")
/* if u.User == nil {
// XXX check/use other url fields return nil, fmt.Errorf("neo: open %q: cluster name not specified")
net := xnet.NetPlain("tcp") // TODO + TLS; not only "tcp" ?
storLink, err := neo.DialLink(ctx, net, u.Host) // XXX -> Dial
if err != nil {
return nil, err
} }
// close storLink on error or ctx cancel // XXX check/use other url fields
defer func() { net := xnet.NetPlain("tcp") // TODO + TLS; not only "tcp" ?
if err != nil {
storLink.Close()
}
}()
// XXX try to prettify this
type Result struct {*Client; error}
done := make(chan Result, 1)
go func() {
client, err := NewClient(storLink)
done <- Result{client, err}
}()
select {
case <-ctx.Done():
return nil, ctx.Err()
case r := <-done: // XXX we are not passing ctx to NewClient - right?
return r.Client, r.error // as ctx for open can be done after open finishes - not covering
} // whole storage working lifetime.
*/ return NewClient(u.User.Username(), u.Host, net), nil
} }
func init() { func init() {
......
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