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
b2f0b1c6
Commit
b2f0b1c6
authored
Sep 01, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
62117b70
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
19 deletions
+20
-19
go/neo/client/client.go
go/neo/client/client.go
+5
-6
go/neo/neo.go
go/neo/neo.go
+6
-5
go/neo/nodetab.go
go/neo/nodetab.go
+3
-2
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+2
-2
go/neo/server/master.go
go/neo/server/master.go
+2
-2
go/neo/server/storage.go
go/neo/server/storage.go
+2
-2
No files found.
go/neo/client/client.go
View file @
b2f0b1c6
...
...
@@ -43,7 +43,7 @@ import (
// Client talks to NEO cluster and exposes access to it via ZODB interfaces.
type
Client
struct
{
node
neo
.
Node
Common
node
neo
.
Node
App
talkMasterCancel
func
()
...
...
@@ -62,7 +62,7 @@ type Client struct {
// - .ClusterState = RUNNING <- XXX needed?
//
// however master link is accessed separately (see ^^^ and masterLink)
operational
bool
// XXX <- somehow move to Node
Common
?
operational
bool
// XXX <- somehow move to Node
App
?
opReady
chan
struct
{}
// reinitialized each time state becomes non-operational
}
...
...
@@ -77,7 +77,7 @@ func (c *Client) StorageName() string {
// It will connect to master @masterAddr and identify with sepcified cluster name.
func
NewClient
(
clusterName
,
masterAddr
string
,
net
xnet
.
Networker
)
*
Client
{
cli
:=
&
Client
{
node
:
neo
.
Node
Common
{
node
:
neo
.
Node
App
{
MyInfo
:
neo
.
NodeInfo
{
Type
:
neo
.
CLIENT
,
Addr
:
neo
.
Address
{}},
ClusterName
:
clusterName
,
Net
:
net
,
...
...
@@ -368,15 +368,14 @@ func (c *Client) LastOid(ctx context.Context) (zodb.Oid, error) {
}
func
(
c
*
Client
)
Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
data
[]
byte
,
serial
zodb
.
Tid
,
err
error
)
{
// XXX err context (but keep zodb errors intact ?)
defer
xerr
.
Contextf
(
&
err
,
"client: load %v"
,
xid
)
defer
xerr
.
Contextf
(
&
err
,
"client: load %v"
,
xid
)
// XXX keep zodb errors intact?
err
=
c
.
withOperational
(
ctx
)
if
err
!=
nil
{
return
nil
,
0
,
err
}
//
H
ere we have cluster state operational and rlocked. Retrieve
//
h
ere we have cluster state operational and rlocked. Retrieve
// storages we might need to access and release the lock.
storv
:=
make
([]
*
neo
.
Node
,
0
)
for
_
,
cell
:=
range
c
.
node
.
PartTab
.
Get
(
xid
.
Oid
)
{
...
...
go/neo/neo.go
View file @
b2f0b1c6
...
...
@@ -49,10 +49,10 @@ const (
)
// Node
Common is common data in all NEO nodes: Master, Storage & Client XXX text
//
XXX naming -> Node ?
// Node
App is base for implementing NEO node applications.
//
// XXX -> internal?
type
Node
Common
struct
{
type
Node
App
struct
{
MyInfo
NodeInfo
ClusterName
string
...
...
@@ -70,7 +70,7 @@ type NodeCommon struct {
// It handshakes, requests identification and checks peer type. If successful returned are:
// - primary link connection which carried identification
// - accept identification reply
func
(
n
*
Node
Common
)
Dial
(
ctx
context
.
Context
,
peerType
NodeType
,
addr
string
)
(
_
*
Conn
,
_
*
AcceptIdentification
,
err
error
)
{
func
(
n
*
Node
App
)
Dial
(
ctx
context
.
Context
,
peerType
NodeType
,
addr
string
)
(
_
*
Conn
,
_
*
AcceptIdentification
,
err
error
)
{
link
,
err
:=
DialLink
(
ctx
,
n
.
Net
,
addr
)
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
@@ -117,9 +117,10 @@ func (n *NodeCommon) Dial(ctx context.Context, peerType NodeType, addr string) (
// Listen starts listening at node's listening address.
//
// If the address is empty one new free is automatically selected.
// The node information about where it listens at is appropriately updated.
func
(
n
*
Node
Common
)
Listen
()
(
Listener
,
error
)
{
func
(
n
*
Node
App
)
Listen
()
(
Listener
,
error
)
{
// start listening
ll
,
err
:=
ListenLink
(
n
.
Net
,
n
.
MyInfo
.
Addr
.
String
())
if
err
!=
nil
{
...
...
go/neo/nodetab.go
View file @
b2f0b1c6
...
...
@@ -69,6 +69,7 @@ type NodeTable struct {
//trace:event traceNodeChanged(nt *NodeTable, n *Node)
// Node represents a peer node in the cluster.
//
// XXX name as Peer?
type
Node
struct
{
nodeTab
*
NodeTable
// this node is part of
...
...
@@ -336,7 +337,7 @@ type dialed struct {
ready
chan
struct
{}
}
// Dial
return
s link to peer node.
// Dial
establishe
s link to peer node.
//
// If the link was not yet established Dial dials the peer appropriately,
// handshakes, requests identification and checks that identification reply is
...
...
@@ -470,7 +471,7 @@ func (p *Peer) PutConn(c *Conn) {
// dial does low-level work to dial peer
// XXX p.* reading without lock - ok?
func
(
p
*
Node
)
dial
(
ctx
context
.
Context
)
(
*
NodeLink
,
error
)
{
var
me
*
Node
Common
// XXX temp stub
var
me
*
Node
App
// XXX bad -> crashes
conn0
,
accept
,
err
:=
me
.
Dial
(
ctx
,
p
.
Type
,
p
.
Addr
.
String
())
if
err
!=
nil
{
return
nil
,
err
...
...
go/neo/server/cluster_test.go
View file @
b2f0b1c6
...
...
@@ -211,7 +211,7 @@ func TestMasterStorage(t *testing.T) {
}
// shortcut for nodetab change
node
:=
func
(
x
*
neo
.
Node
Common
,
laddr
string
,
typ
neo
.
NodeType
,
num
int32
,
state
neo
.
NodeState
,
idtstamp
float64
)
*
traceNode
{
node
:=
func
(
x
*
neo
.
Node
App
,
laddr
string
,
typ
neo
.
NodeType
,
num
int32
,
state
neo
.
NodeState
,
idtstamp
float64
)
*
traceNode
{
return
&
traceNode
{
NodeTab
:
unsafe
.
Pointer
(
x
.
NodeTab
),
NodeInfo
:
nodei
(
laddr
,
typ
,
num
,
state
,
idtstamp
),
...
...
@@ -394,7 +394,7 @@ func TestMasterStorage(t *testing.T) {
},
}))
Cnode
:=
(
*
neo
.
Node
Common
)(
unsafe
.
Pointer
(
C
))
// XXX hack
Cnode
:=
(
*
neo
.
Node
App
)(
unsafe
.
Pointer
(
C
))
// XXX hack
tc
.
Expect
(
node
(
Cnode
,
"m:1"
,
neo
.
MASTER
,
1
,
neo
.
RUNNING
,
0.00
))
tc
.
Expect
(
node
(
Cnode
,
"s:1"
,
neo
.
STORAGE
,
1
,
neo
.
RUNNING
,
0.01
))
tc
.
Expect
(
node
(
Cnode
,
""
,
neo
.
CLIENT
,
1
,
neo
.
RUNNING
,
0.02
))
...
...
go/neo/server/master.go
View file @
b2f0b1c6
...
...
@@ -44,7 +44,7 @@ import (
// Master is a node overseeing and managing how whole NEO cluster works
type
Master
struct
{
node
neo
.
Node
Common
node
neo
.
Node
App
// master manages node and partition tables and broadcast their updates
// to all nodes in cluster
...
...
@@ -90,7 +90,7 @@ func NewMaster(clusterName, serveAddr string, net xnet.Networker) *Master {
}
m
:=
&
Master
{
node
:
neo
.
Node
Common
{
node
:
neo
.
Node
App
{
MyInfo
:
neo
.
NodeInfo
{
Type
:
neo
.
MASTER
,
Addr
:
addr
},
ClusterName
:
clusterName
,
Net
:
net
,
...
...
go/neo/server/storage.go
View file @
b2f0b1c6
...
...
@@ -39,7 +39,7 @@ import (
// Storage is NEO node that keeps data and provides read/write access to it
type
Storage
struct
{
node
neo
.
Node
Common
node
neo
.
Node
App
// context for providing operational service
// it is renewed every time master tells us StartOpertion, so users
...
...
@@ -68,7 +68,7 @@ func NewStorage(cluster, masterAddr, serveAddr string, net xnet.Networker, zstor
}
stor
:=
&
Storage
{
node
:
neo
.
Node
Common
{
node
:
neo
.
Node
App
{
MyInfo
:
neo
.
NodeInfo
{
Type
:
neo
.
STORAGE
,
Addr
:
addr
},
ClusterName
:
cluster
,
Net
:
net
,
...
...
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