Commit 8e627a24 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e956f33c
...@@ -112,6 +112,7 @@ func (cli *Client) Run(ctx context.Context) error { ...@@ -112,6 +112,7 @@ func (cli *Client) Run(ctx context.Context) error {
return cli.talkMaster(ctx) return cli.talkMaster(ctx)
} }
// Close implements zodb.IStorageDriver.
func (c *Client) Close() (err error) { func (c *Client) Close() (err error) {
c.talkMasterCancel() c.talkMasterCancel()
// XXX wait talkMaster finishes -> XXX return err from that? // XXX wait talkMaster finishes -> XXX return err from that?
...@@ -483,6 +484,7 @@ func (c *Client) flushEventq0() { ...@@ -483,6 +484,7 @@ func (c *Client) flushEventq0() {
// --- user API calls --- // --- user API calls ---
// Sync implements zodb.IStorageDriver.
func (c *Client) Sync(ctx context.Context) (_ zodb.Tid, err error) { func (c *Client) Sync(ctx context.Context) (_ zodb.Tid, err error) {
defer func() { defer func() {
if err != nil { if err != nil {
...@@ -507,6 +509,7 @@ func (c *Client) Sync(ctx context.Context) (_ zodb.Tid, err error) { ...@@ -507,6 +509,7 @@ func (c *Client) Sync(ctx context.Context) (_ zodb.Tid, err error) {
return reply.Tid, nil return reply.Tid, nil
} }
// Load implements zodb.IStorageDriver.
func (c *Client) Load(ctx context.Context, xid zodb.Xid) (buf *mem.Buf, serial zodb.Tid, err error) { func (c *Client) Load(ctx context.Context, xid zodb.Xid) (buf *mem.Buf, serial zodb.Tid, err error) {
defer func() { defer func() {
if err != nil { if err != nil {
...@@ -599,15 +602,12 @@ func (c *Client) Load(ctx context.Context, xid zodb.Xid) (buf *mem.Buf, serial z ...@@ -599,15 +602,12 @@ func (c *Client) Load(ctx context.Context, xid zodb.Xid) (buf *mem.Buf, serial z
return buf, resp.Serial, nil return buf, resp.Serial, nil
} }
// Iterate implements zodb.IStorageDriver.
func (c *Client) Iterate(ctx context.Context, tidMin, tidMax zodb.Tid) zodb.ITxnIterator { func (c *Client) Iterate(ctx context.Context, tidMin, tidMax zodb.Tid) zodb.ITxnIterator {
// see notes in ../NOTES:"On iteration" // see notes in ../NOTES:"On iteration"
panic("TODO") panic("TODO")
} }
func (c *Client) Watch(ctx context.Context) (zodb.Tid, []zodb.Oid, error) {
panic("TODO")
}
// ---- ZODB open/url support ---- // ---- ZODB open/url support ----
...@@ -728,6 +728,7 @@ func openClientByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) ( ...@@ -728,6 +728,7 @@ func openClientByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (
} }
} }
// URL implements zodb.IStorageDriver.
func (c *Client) URL() string { func (c *Client) URL() string {
// XXX options if such were given to open are discarded // XXX options if such were given to open are discarded
// (but we need to be able to construct URL if Client was created via NewClient directly) // (but we need to be able to construct URL if Client was created via NewClient directly)
......
...@@ -52,9 +52,9 @@ type NodeApp struct { ...@@ -52,9 +52,9 @@ type NodeApp struct {
MasterAddr string // address of current master XXX put under StateMu ? MasterAddr string // address of current master XXX put under StateMu ?
StateMu sync.RWMutex // <- XXX just embed? StateMu sync.RWMutex // <- XXX just embed?
NodeTab *NodeTable // information about nodes in the cluster NodeTab *NodeTable // information about nodes in the cluster
PartTab *PartitionTable // information about data distribution in the cluster PartTab *PartitionTable // information about data distribution in the cluster
ClusterState proto.ClusterState // master idea about cluster state ClusterState proto.ClusterState // master idea about cluster state
// should be set by user so NodeApp can notify when master tells this node to shutdown // should be set by user so NodeApp can notify when master tells this node to shutdown
OnShutdown func() OnShutdown func()
...@@ -86,6 +86,8 @@ func NewNodeApp(net xnet.Networker, typ proto.NodeType, clusterName, masterAddr ...@@ -86,6 +86,8 @@ func NewNodeApp(net xnet.Networker, typ proto.NodeType, clusterName, masterAddr
// //
// Dial does not update .NodeTab or its node entries in any way. // Dial does not update .NodeTab or its node entries in any way.
// For establishing links to peers present in .NodeTab use Node.Dial. // For establishing links to peers present in .NodeTab use Node.Dial.
//
// XXX unexport
func (app *NodeApp) Dial(ctx context.Context, peerType proto.NodeType, addr string) (_ *neonet.NodeLink, _ *proto.AcceptIdentification, err error) { func (app *NodeApp) Dial(ctx context.Context, peerType proto.NodeType, addr string) (_ *neonet.NodeLink, _ *proto.AcceptIdentification, err error) {
defer task.Runningf(&ctx, "dial %v (%v)", addr, peerType)(&err) defer task.Runningf(&ctx, "dial %v (%v)", addr, peerType)(&err)
...@@ -177,7 +179,7 @@ func requireIdentifyHello(inner neonet.LinkListener) Listener { ...@@ -177,7 +179,7 @@ func requireIdentifyHello(inner neonet.LinkListener) Listener {
} }
type listener struct { type listener struct {
l neonet.LinkListener l neonet.LinkListener
} }
func (l *listener) Accept(ctx context.Context) (_ *neonet.Request, _ *proto.RequestIdentification, err error) { func (l *listener) Accept(ctx context.Context) (_ *neonet.Request, _ *proto.RequestIdentification, err error) {
......
// Copyright (C) 2017 Nexedi SA and Contributors. // Copyright (C) 2017-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your // it under the terms of the GNU General Public License version 3, or (at your
...@@ -33,4 +33,5 @@ func monotime() float64 { ...@@ -33,4 +33,5 @@ func monotime() float64 {
return time.Now().Sub(tstart).Seconds() return time.Now().Sub(tstart).Seconds()
} }
// FIXME py retruns it since epoch
var tstart time.Time = time.Now() var tstart time.Time = time.Now()
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