Commit 3ad0b220 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2a17421f
......@@ -19,12 +19,14 @@ package neo
// access to NEO database via ZODB interfaces
import (
"context"
"net/url"
"../zodb"
)
type Client struct {
storLink NodeLink // link to storage node
storLink *NodeLink // link to storage node
}
var _ zodb.IStorage = (*Client)(nil)
......@@ -52,3 +54,21 @@ func (c *Client) Load(xid zodb.Xid) (data []byte, tid zodb.Tid, err error) {
func (c *Client) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
panic("TODO")
}
// TODO read-only support
func openClientByURL(u *url.URL) (zodb.IStorage, error) {
// XXX for now url is treated as storage node URL
// XXX check/use other url fields
ctx := context.Background() // XXX ok?
storLink, err := Dial(ctx, "tcp", u.Host)
if err != nil {
return nil, err
}
return &Client{storLink}, nil
}
func init() {
zodb.RegisterStorage("neo", openClientByURL)
}
......@@ -27,7 +27,7 @@ import (
"os"
"../zodb"
_ "../zodb/wks"
"../zodb/storage/fs1"
)
// NEO Storage application
......@@ -226,7 +226,7 @@ func storageMain(argv []string) {
}
// XXX hack
zstor, err := zodb.OpenStorageURL(argv[0])
zstor, err := fs1.Open(argv[0])
if err != nil {
log.Fatal(err)
}
......
......@@ -26,4 +26,5 @@ package wks
import (
_ "../../zodb/storage/fs1"
_ "../../neo" // XXX split into neo/client ?
)
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