Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
92fd18ce
Commit
92fd18ce
authored
May 05, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ff41fbb4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
go/neo/proto.go
go/neo/proto.go
+7
-0
go/nodetab.go
go/nodetab.go
+18
-0
neo/lib/pt.py
neo/lib/pt.py
+2
-2
No files found.
go/neo/proto.go
View file @
92fd18ce
...
@@ -4,6 +4,11 @@
...
@@ -4,6 +4,11 @@
package
neo
package
neo
// NOTE for some packets it is possible to decode raw packet -> go version from
// PktBuf in place. E.g. for GetObject.
//
// TODO work this out
// XXX move imports out of here
// XXX move imports out of here
import
(
import
(
"../zodb"
"../zodb"
...
@@ -661,6 +666,8 @@ type AnswerPartitionList struct {
...
@@ -661,6 +666,8 @@ type AnswerPartitionList struct {
// Ask information about nodes
// Ask information about nodes
// Answer information about nodes
// Answer information about nodes
//
// XXX neoctl -> A (A just extracts data from its nodetab)
type
NodeList
struct
{
type
NodeList
struct
{
NodeType
NodeType
}
}
...
...
go/nodetab.go
View file @
92fd18ce
...
@@ -18,6 +18,10 @@
...
@@ -18,6 +18,10 @@
package
neo
package
neo
// node management & node table
// node management & node table
import
(
"sync"
)
// Node represents a node from local-node point of view
// Node represents a node from local-node point of view
type
Node
struct
{
type
Node
struct
{
Info
NodeInfo
Info
NodeInfo
...
@@ -29,4 +33,18 @@ type Node struct {
...
@@ -29,4 +33,18 @@ type Node struct {
// NodeTable represents all known nodes in a cluster from local-node point of view
// NodeTable represents all known nodes in a cluster from local-node point of view
type
NodeTable
struct
{
type
NodeTable
struct
{
// users have to care locking explicitly
sync
.
Mutex
// XXX -> RWMutex ?
}
// UpdateNode updates information about a node
func
(
nt
*
NodeTable
)
UpdateNode
(
nodeInfo
NodeInfo
)
{
// TODO
}
}
// XXX ? ^^^ UpdateNode is enough ?
func
(
nt
*
NodeTable
)
Add
(
node
*
Node
)
{
// TODO
}
// TODO subscribe for changes on Add ? (notification via channel)
neo/lib/pt.py
View file @
92fd18ce
...
@@ -210,7 +210,7 @@ class PartitionTable(object):
...
@@ -210,7 +210,7 @@ class PartitionTable(object):
if
offset
>=
self
.
getPartitions
():
if
offset
>=
self
.
getPartitions
():
raise
IndexError
raise
IndexError
for
uuid
,
state
in
row
:
for
uuid
,
state
in
row
:
node
=
nm
.
getByUUID
(
uuid
)
node
=
nm
.
getByUUID
(
uuid
)
# NOTE pt <-> nm interrelation
# the node must be known by the node manager
# the node must be known by the node manager
assert
node
is
not
None
assert
node
is
not
None
self
.
_setCell
(
offset
,
node
,
state
)
self
.
_setCell
(
offset
,
node
,
state
)
...
@@ -231,7 +231,7 @@ class PartitionTable(object):
...
@@ -231,7 +231,7 @@ class PartitionTable(object):
break
break
readable_list
+=
row
readable_list
+=
row
for
offset
,
uuid
,
state
in
cell_list
:
for
offset
,
uuid
,
state
in
cell_list
:
node
=
nm
.
getByUUID
(
uuid
)
node
=
nm
.
getByUUID
(
uuid
)
# NOTE pt <-> nm interrelation
assert
node
is
not
None
,
'No node found for uuid '
+
uuid_str
(
uuid
)
assert
node
is
not
None
,
'No node found for uuid '
+
uuid_str
(
uuid
)
self
.
_setCell
(
offset
,
node
,
state
)
self
.
_setCell
(
offset
,
node
,
state
)
self
.
logUpdated
()
self
.
logUpdated
()
...
...
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