Commit 67c111ef authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 48110f65
...@@ -48,19 +48,19 @@ func xfs1stor(path string) (*Storage, *fs1.FileStorage) { ...@@ -48,19 +48,19 @@ func xfs1stor(path string) (*Storage, *fs1.FileStorage) {
// M drives cluster with 1 S through recovery -> verification -> service -> shutdown // M drives cluster with 1 S through recovery -> verification -> service -> shutdown
func TestMasterStorage(t *testing.T) { func TestMasterStorage(t *testing.T) {
net := NetPipe("") // test network XXX New registers to global table net := NetPipe("") // test network FIXME New registers to global table
S, _ := xfs1stor("../zodb/storage/fs1/testdata/1.fs") // XXX +readonly
M := NewMaster("abc1") M := NewMaster("abc1")
S, _ := xfs1stor("../zodb/storage/fs1/testdata/1.fs") // XXX +readonly
Sctx, Scancel := context.WithCancel(context.Background())
Mctx, Mcancel := context.WithCancel(context.Background()) Mctx, Mcancel := context.WithCancel(context.Background())
Sctx, Scancel := context.WithCancel(context.Background())
// XXX temp // XXX temp
Sbind := ""; Mbind := ""; var err error Sbind := ""; Mbind := ""; var err error
_ = Scancel; _ = Mcancel; _ = err _ = Scancel; _ = Mcancel; _ = err
err = ListenAndServe(Sctx, net, Sbind, S) // XXX go
err = ListenAndServe(Mctx, net, Mbind, M) // XXX go err = ListenAndServe(Mctx, net, Mbind, M) // XXX go
err = ListenAndServe(Sctx, net, Sbind, S) // XXX go
} }
// basic interaction between Client -- Storage // basic interaction between Client -- Storage
......
...@@ -690,38 +690,9 @@ func Dial(ctx context.Context, net Network, addr string) (nl *NodeLink, err erro ...@@ -690,38 +690,9 @@ func Dial(ctx context.Context, net Network, addr string) (nl *NodeLink, err erro
return Handshake(ctx, peerConn, LinkClient) return Handshake(ctx, peerConn, LinkClient)
} }
/* TODO not needed -> goes away // NOTE there is no Listen with Handshake hooked into Accept because: Handshake
// Listener is like net.Listener but Accept returns net.Conn wrapped in NodeLink and handshaked XXX // is blocking operation and thus needs to be run in separate goroutine not to
type Listener struct { // block further Accepts.
net.Listener
}
func (l *Listener) Accept() (*NodeLink, error) {
peerConn, err := l.Listener.Accept()
if err != nil {
return nil, err
}
err = Handshake(peerConn) // FIXME blocking - not good - blocks further Accepts
if err != nil {
peerConn.Close()
return nil, err
}
return NewNodeLink(peerConn, LinkServer), nil
}
// TODO +tls.Config
// TODO +ctx -> no as .Close() will interrupt all .Accept()
func Listen(network, laddr string) (*Listener, error) {
l, err := net.Listen(network, laddr)
if err != nil {
return nil, err
}
return &Listener{l}, nil
}
*/
// ---- for convenience: String / Error ---- // ---- for convenience: String / Error ----
......
...@@ -234,7 +234,7 @@ type NodeInfo struct { ...@@ -234,7 +234,7 @@ type NodeInfo struct {
Address // serving address Address // serving address
NodeUUID NodeUUID
NodeState NodeState
IdTimestamp float64 IdTimestamp float64 // FIXME clarify semantic where it is used
} }
// XXX -> parttab.go ? // XXX -> parttab.go ?
......
...@@ -82,7 +82,6 @@ func ListenAndServe(ctx context.Context, net Network, laddr string, srv Server) ...@@ -82,7 +82,6 @@ func ListenAndServe(ctx context.Context, net Network, laddr string, srv Server)
return err return err
} }
// TODO set keepalive on l // TODO set keepalive on l
// TODO if TLS config -> tls.NewListener()
return Serve(ctx, l, srv) return Serve(ctx, l, srv)
} }
......
...@@ -36,6 +36,8 @@ import ( ...@@ -36,6 +36,8 @@ import (
// Storage is NEO storage server application // Storage is NEO storage server application
type Storage struct { type Storage struct {
me NodeInfo // XXX -> only Address + NodeUUID ?
zstor zodb.IStorage // underlying ZODB storage XXX temp ? zstor zodb.IStorage // underlying ZODB storage XXX temp ?
} }
......
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