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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
81736b44
Commit
81736b44
authored
Jun 14, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X Network -> Networker (there can be many access-points (Networkers) to 1 Network)
parent
f5c1174f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
22 deletions
+18
-22
go/neo/client/client.go
go/neo/client/client.go
+1
-1
go/neo/connection.go
go/neo/connection.go
+1
-1
go/neo/server/master.go
go/neo/server/master.go
+2
-2
go/neo/server/storage.go
go/neo/server/storage.go
+2
-2
go/xcommon/xnet/net.go
go/xcommon/xnet/net.go
+8
-12
go/xcommon/xnet/trace.go
go/xcommon/xnet/trace.go
+4
-4
No files found.
go/neo/client/client.go
View file @
81736b44
...
@@ -34,7 +34,7 @@ type Client struct {
...
@@ -34,7 +34,7 @@ type Client struct {
myInfo
neo
.
NodeInfo
// XXX -> only NodeUUID
myInfo
neo
.
NodeInfo
// XXX -> only NodeUUID
clusterName
string
clusterName
string
net
xnet
.
Network
// network
we are sending/receiving on
net
xnet
.
Network
er
// network AP
we are sending/receiving on
masterAddr
string
// address of master XXX -> Address ?
masterAddr
string
// address of master XXX -> Address ?
// ---- 8< ----
// ---- 8< ----
...
...
go/neo/connection.go
View file @
81736b44
...
@@ -683,7 +683,7 @@ func handshake(ctx context.Context, conn net.Conn, version uint32) (err error) {
...
@@ -683,7 +683,7 @@ func handshake(ctx context.Context, conn net.Conn, version uint32) (err error) {
// ---- for convenience: Dial ----
// ---- for convenience: Dial ----
// Dial connects to address on given network, handshakes and wraps the connection as NodeLink
// Dial connects to address on given network, handshakes and wraps the connection as NodeLink
func
Dial
(
ctx
context
.
Context
,
net
xnet
.
Network
,
addr
string
)
(
nl
*
NodeLink
,
err
error
)
{
func
Dial
(
ctx
context
.
Context
,
net
xnet
.
Network
er
,
addr
string
)
(
nl
*
NodeLink
,
err
error
)
{
peerConn
,
err
:=
net
.
Dial
(
ctx
,
addr
)
peerConn
,
err
:=
net
.
Dial
(
ctx
,
addr
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
go/neo/server/master.go
View file @
81736b44
...
@@ -40,7 +40,7 @@ type Master struct {
...
@@ -40,7 +40,7 @@ type Master struct {
myInfo
neo
.
NodeInfo
myInfo
neo
.
NodeInfo
clusterName
string
clusterName
string
net
xnet
.
Network
// network
we are sending/receiving on
net
xnet
.
Network
er
// network AP
we are sending/receiving on
masterAddr
string
// address of current primary master
masterAddr
string
// address of current primary master
// ---- 8< ----
// ---- 8< ----
...
@@ -84,7 +84,7 @@ type nodeLeave struct {
...
@@ -84,7 +84,7 @@ type nodeLeave struct {
// NewMaster creates new master node that will listen on serveAddr
// NewMaster creates new master node that will listen on serveAddr
// Use Run to actually start running the node.
// Use Run to actually start running the node.
func
NewMaster
(
clusterName
,
serveAddr
string
,
net
xnet
.
Network
)
*
Master
{
func
NewMaster
(
clusterName
,
serveAddr
string
,
net
xnet
.
Network
er
)
*
Master
{
// convert serveAddr into neo format
// convert serveAddr into neo format
addr
,
err
:=
neo
.
AddrString
(
net
.
Network
(),
serveAddr
)
addr
,
err
:=
neo
.
AddrString
(
net
.
Network
(),
serveAddr
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
go/neo/server/storage.go
View file @
81736b44
...
@@ -38,7 +38,7 @@ type Storage struct {
...
@@ -38,7 +38,7 @@ type Storage struct {
myInfo
neo
.
NodeInfo
// XXX -> only Address + NodeUUID ?
myInfo
neo
.
NodeInfo
// XXX -> only Address + NodeUUID ?
clusterName
string
clusterName
string
net
xnet
.
Network
// network
we are sending/receiving on
net
xnet
.
Network
er
// network AP
we are sending/receiving on
masterAddr
string
// address of master
masterAddr
string
// address of master
// ---- 8< ----
// ---- 8< ----
...
@@ -48,7 +48,7 @@ type Storage struct {
...
@@ -48,7 +48,7 @@ type Storage struct {
// NewStorage creates new storage node that will listen on serveAddr and talk to master on masterAddr
// NewStorage creates new storage node that will listen on serveAddr and talk to master on masterAddr
// The storage uses zstor as underlying backend for storing data.
// The storage uses zstor as underlying backend for storing data.
// Use Run to actually start running the node.
// Use Run to actually start running the node.
func
NewStorage
(
cluster
,
masterAddr
,
serveAddr
string
,
net
xnet
.
Network
,
zstor
zodb
.
IStorage
)
*
Storage
{
func
NewStorage
(
cluster
,
masterAddr
,
serveAddr
string
,
net
xnet
.
Network
er
,
zstor
zodb
.
IStorage
)
*
Storage
{
// convert serveAddr into neo format
// convert serveAddr into neo format
addr
,
err
:=
neo
.
AddrString
(
net
.
Network
(),
serveAddr
)
addr
,
err
:=
neo
.
AddrString
(
net
.
Network
(),
serveAddr
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
go/xcommon/xnet/net.go
View file @
81736b44
...
@@ -25,13 +25,9 @@ import (
...
@@ -25,13 +25,9 @@ import (
"crypto/tls"
"crypto/tls"
)
)
// Network is the interface to work with various kinds of streaming networks
// Networker is interface representing access-point to a streaming network
//
type
Networker
interface
{
// NOTE in NEO a node usually needs to both 1) listen and serve incoming
// Network returns name of the network XXX recheck
// connections, and 2) dial peers. For this reason the interface is not split
// into Dialer and Listener.
type
Network
interface
{
// Network returns name of the network
Network
()
string
Network
()
string
// Dial connects to addr on underlying network
// Dial connects to addr on underlying network
...
@@ -46,9 +42,9 @@ type Network interface {
...
@@ -46,9 +42,9 @@ type Network interface {
}
}
// NetPlain creates Network
corresponding to regular network
// NetPlain creates Network
er corresponding to regular network accessors from std package net
// network is "tcp", "tcp4", "tcp6", "unix", etc...
// network is "tcp", "tcp4", "tcp6", "unix", etc...
func
NetPlain
(
network
string
)
Network
{
func
NetPlain
(
network
string
)
Network
er
{
return
netPlain
(
network
)
return
netPlain
(
network
)
}
}
...
@@ -67,16 +63,16 @@ func (n netPlain) Listen(laddr string) (net.Listener, error) {
...
@@ -67,16 +63,16 @@ func (n netPlain) Listen(laddr string) (net.Listener, error) {
return
net
.
Listen
(
string
(
n
),
laddr
)
return
net
.
Listen
(
string
(
n
),
laddr
)
}
}
// NetTLS wraps underlying network with TLS layer according to config
// NetTLS wraps underlying network
er
with TLS layer according to config
// The config must be valid:
// The config must be valid:
// - for tls.Client -- for Dial to work,
// - for tls.Client -- for Dial to work,
// - for tls.Server -- for Listen to work.
// - for tls.Server -- for Listen to work.
func
NetTLS
(
inner
Network
,
config
*
tls
.
Config
)
Network
{
func
NetTLS
(
inner
Network
er
,
config
*
tls
.
Config
)
Networker
{
return
&
netTLS
{
inner
,
config
}
return
&
netTLS
{
inner
,
config
}
}
}
type
netTLS
struct
{
type
netTLS
struct
{
inner
Network
inner
Network
er
config
*
tls
.
Config
config
*
tls
.
Config
}
}
...
...
go/xcommon/xnet/trace.go
View file @
81736b44
...
@@ -24,7 +24,7 @@ import (
...
@@ -24,7 +24,7 @@ import (
"net"
"net"
)
)
// NetTrace wraps underlying network with IO tracing layer
// NetTrace wraps underlying network
er
with IO tracing layer
//
//
// Tracing is done via calling trace func right before corresponding packet
// Tracing is done via calling trace func right before corresponding packet
// is sent for Tx to underlying network. No synchronization for notification is
// is sent for Tx to underlying network. No synchronization for notification is
...
@@ -34,7 +34,7 @@ import (
...
@@ -34,7 +34,7 @@ import (
// only Tx events are traced:
// only Tx events are traced:
// - because Write, contrary to Read, never writes partial data on non-error
// - because Write, contrary to Read, never writes partial data on non-error
// - because in case of pipenet tracing writes only is enough to get whole network exchange picture
// - because in case of pipenet tracing writes only is enough to get whole network exchange picture
func
NetTrace
(
inner
Network
,
tracer
Tracer
)
Network
{
func
NetTrace
(
inner
Network
er
,
tracer
Tracer
)
Networker
{
return
&
netTrace
{
inner
,
tracer
}
return
&
netTrace
{
inner
,
tracer
}
}
}
...
@@ -62,10 +62,10 @@ type TraceTx struct {
...
@@ -62,10 +62,10 @@ type TraceTx struct {
Pkt
[]
byte
Pkt
[]
byte
}
}
// netTrace wraps underlying Network such that whenever a connection is created
// netTrace wraps underlying Network
er
such that whenever a connection is created
// it is wrapped with traceConn
// it is wrapped with traceConn
type
netTrace
struct
{
type
netTrace
struct
{
inner
Network
inner
Network
er
tracer
Tracer
tracer
Tracer
}
}
...
...
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