Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
dfe103d8
Commit
dfe103d8
authored
May 03, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X Decided that we need to have go master for tests wrt py client
parent
a95287ab
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
116 additions
and
16 deletions
+116
-16
go/NOTES-go
go/NOTES-go
+0
-12
go/neo/cluster_test.go
go/neo/cluster_test.go
+3
-0
go/neo/command.go
go/neo/command.go
+1
-0
go/neo/master.go
go/neo/master.go
+108
-0
go/neo/storage.go
go/neo/storage.go
+4
-4
No files found.
go/NOTES-go
View file @
dfe103d8
...
@@ -13,18 +13,6 @@
...
@@ -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 Execution Tracer"
go.leveldb - study
go.leveldb - study
...
...
go/neo/cluster_test.go
View file @
dfe103d8
...
@@ -113,6 +113,9 @@ func TestClientStorage(t *testing.T) {
...
@@ -113,6 +113,9 @@ func TestClientStorage(t *testing.T) {
}
}
// TODO Iterate (not yet implemented for NEO)
// shutdown storage
// shutdown storage
// XXX wait for S to shutdown + verify shutdown error
// XXX wait for S to shutdown + verify shutdown error
Scancel
()
Scancel
()
...
...
go/neo/command.go
View file @
dfe103d8
...
@@ -21,6 +21,7 @@ package neo
...
@@ -21,6 +21,7 @@ package neo
import
"../zodb/zodbtools"
import
"../zodb/zodbtools"
var
Commands
=
zodbtools
.
CommandRegistry
{
var
Commands
=
zodbtools
.
CommandRegistry
{
{
"master"
,
masterSummary
,
masterUsage
,
masterMain
},
{
"storage"
,
storageSummary
,
storageUsage
,
storageMain
},
{
"storage"
,
storageSummary
,
storageUsage
,
storageMain
},
}
}
...
...
go/neo/master.go
0 → 100644
View file @
dfe103d8
// 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
)
}
}
go/neo/storage.go
View file @
dfe103d8
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
// See COPYING file for full licensing terms.
// See COPYING file for full licensing terms.
package
neo
package
neo
//
NEO
storage node
// storage node
import
(
import
(
"context"
"context"
...
@@ -32,6 +32,8 @@ import (
...
@@ -32,6 +32,8 @@ import (
"../zodb/storage/fs1"
"../zodb/storage/fs1"
)
)
// XXX fmt -> log
// Storage is NEO storage server application
// Storage is NEO storage server application
type
Storage
struct
{
type
Storage
struct
{
zstor
zodb
.
IStorage
// underlying ZODB storage XXX temp ?
zstor
zodb
.
IStorage
// underlying ZODB storage XXX temp ?
...
@@ -214,7 +216,7 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *Conn) {
...
@@ -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:
// TODO options:
// cluster, masterv ...
// cluster, masterv ...
...
@@ -231,8 +233,6 @@ Run NEO storage node.
...
@@ -231,8 +233,6 @@ Run NEO storage node.
func
storageMain
(
argv
[]
string
)
{
func
storageMain
(
argv
[]
string
)
{
var
bind
string
var
bind
string
//flags := flag.FlagSet{Usage: func() { storageUsage(os.Stderr) }}
//flags.Init("", flag.ExitOnError)
flags
:=
flag
.
NewFlagSet
(
""
,
flag
.
ExitOnError
)
flags
:=
flag
.
NewFlagSet
(
""
,
flag
.
ExitOnError
)
flags
.
Usage
=
func
()
{
storageUsage
(
os
.
Stderr
);
flags
.
PrintDefaults
()
}
// XXX prettify
flags
.
Usage
=
func
()
{
storageUsage
(
os
.
Stderr
);
flags
.
PrintDefaults
()
}
// XXX prettify
flags
.
StringVar
(
&
bind
,
"bind"
,
bind
,
"address to serve on"
)
flags
.
StringVar
(
&
bind
,
"bind"
,
bind
,
"address to serve on"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment