Commit dfe103d8 authored by Kirill Smelkov's avatar Kirill Smelkov

X Decided that we need to have go master for tests wrt py client

parent a95287ab
......@@ -13,18 +13,6 @@
- python pickles
stalecucmber
og-rek
graphite-clickhous/helper/pickle.go
particular fsIndex: by hand
- file size / file offset (off_t) is defined to be _signed_ by posix
-> so use int64 (not uint64) for file pos / size
- "Go Execution Tracer"
go.leveldb - study
......
......@@ -113,6 +113,9 @@ func TestClientStorage(t *testing.T) {
}
// TODO Iterate (not yet implemented for NEO)
// shutdown storage
// XXX wait for S to shutdown + verify shutdown error
Scancel()
......
......@@ -21,6 +21,7 @@ package neo
import "../zodb/zodbtools"
var Commands = zodbtools.CommandRegistry{
{"master", masterSummary, masterUsage, masterMain},
{"storage", storageSummary, storageUsage, storageMain},
}
......
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// 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
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Open Source Initiative approved licenses and Convey
// the resulting work. Corresponding source of such a combination shall include
// the source code for all other software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
package neo
// master node
import (
"context"
"flag"
"fmt"
"io"
"log"
"os"
)
// Master is a node overseeing and managing how whole NEO cluster works
type Master struct {
custerName string
}
func NewMaster(clusterName string) *Master {
return &Master{clusterName}
}
// ServeLink serves incoming node-node link connection
// XXX +error return?
func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
fmt.Printf("master: %s: serving new node\n", link)
// TODO
}
// ServeClient serves incoming connection on which peer identified itself as client
// XXX +error return?
func (m *Master) ServeClient(ctx context.Context, conn *Conn) {
// TODO
}
// ServeStorage serves incoming connection on which peer identified itself as storage
// XXX +error return?
func (m *Master) ServeStorage(ctx context.Context, conn *Conn) {
// TODO
}
// ----------------------------------------
const masterSummary = "run master node"
// TODO options:
// cluster, masterv ...
func masterUsage(w io.Writer) {
fmt.Fprintf(w,
`Usage: neo master [options]
Run NEO master node.
`)
// FIXME use w (see flags.SetOutput)
}
func masterMain(argv []string) {
var bind string
var cluster string
flags := flag.NewFlagSet("", flag.ExitOnError)
flags.Usage = func() { masterUsage(os.Stderr); flags.PrintDefaults() } // XXX prettify
flags.StringVar(&bind, "bind", bind, "address to serve on")
flags.StringVar(&cluster, "cluster", cluster, "cluster name")
flags.Parse(argv[1:])
argv = flags.Args()
if len(argv) < 1 {
flags.Usage()
os.Exit(2)
}
masterSrv := NewMaster(cluster)
ctx := context.Background()
/*
ctx, cancel := context.WithCancel(context.Background())
go func() {
time.Sleep(3 * time.Second)
cancel()
}()
*/
// TODO + TLS
err := ListenAndServe(ctx, "tcp", bind, masterSrv) // XXX "tcp" hardcoded
if err != nil {
log.Fatal(err)
}
}
......@@ -16,7 +16,7 @@
// See COPYING file for full licensing terms.
package neo
// NEO storage node
// storage node
import (
"context"
......@@ -32,6 +32,8 @@ import (
"../zodb/storage/fs1"
)
// XXX fmt -> log
// Storage is NEO storage server application
type Storage struct {
zstor zodb.IStorage // underlying ZODB storage XXX temp ?
......@@ -214,7 +216,7 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *Conn) {
// ----------------------------------------
const storageSummary = "run NEO storage node"
const storageSummary = "run storage node"
// TODO options:
// cluster, masterv ...
......@@ -231,8 +233,6 @@ Run NEO storage node.
func storageMain(argv []string) {
var bind string
//flags := flag.FlagSet{Usage: func() { storageUsage(os.Stderr) }}
//flags.Init("", flag.ExitOnError)
flags := flag.NewFlagSet("", flag.ExitOnError)
flags.Usage = func() { storageUsage(os.Stderr); flags.PrintDefaults() } // XXX prettify
flags.StringVar(&bind, "bind", bind, "address to serve on")
......
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