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
Xavier Thompson
neoppod
Commits
95216790
Commit
95216790
authored
Aug 20, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neoctl: new 'print ids' command
parent
b08a8600
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
14 deletions
+43
-14
neo/admin/handler.py
neo/admin/handler.py
+4
-1
neo/master/handlers/__init__.py
neo/master/handlers/__init__.py
+12
-0
neo/master/handlers/client.py
neo/master/handlers/client.py
+0
-4
neo/master/handlers/storage.py
neo/master/handlers/storage.py
+0
-8
neo/neoctl/app.py
neo/neoctl/app.py
+13
-1
neo/neoctl/handler.py
neo/neoctl/handler.py
+2
-0
neo/neoctl/neoctl.py
neo/neoctl/neoctl.py
+12
-0
No files found.
neo/admin/handler.py
View file @
95216790
...
...
@@ -62,6 +62,8 @@ class AdminEventHandler(EventHandler):
master_node
=
self
.
app
.
master_node
conn
.
answer
(
Packets
.
AnswerPrimary
(
master_node
.
getUUID
()))
askLastIDs
=
forward_ask
(
Packets
.
AskLastIDs
)
askLastTransaction
=
forward_ask
(
Packets
.
AskLastTransaction
)
addPendingNodes
=
forward_ask
(
Packets
.
AddPendingNodes
)
tweakPartitionTable
=
forward_ask
(
Packets
.
TweakPartitionTable
)
setClusterState
=
forward_ask
(
Packets
.
SetClusterState
)
...
...
@@ -90,7 +92,7 @@ class MasterEventHandler(EventHandler):
def
dispatch
(
self
,
conn
,
packet
,
kw
=
{}):
if
'conn'
in
kw
:
# expected answer
if
packet
.
is
Error
():
if
packet
.
is
Response
():
packet
.
setId
(
kw
[
'msg_id'
])
kw
[
'conn'
].
answer
(
packet
)
else
:
...
...
@@ -126,3 +128,4 @@ class MasterEventHandler(EventHandler):
class
MasterRequestEventHandler
(
EventHandler
):
""" This class handle all answer from primary master node"""
# XXX: to be deleted ?
neo/master/handlers/__init__.py
View file @
95216790
...
...
@@ -62,6 +62,18 @@ class MasterHandler(EventHandler):
state
=
self
.
app
.
getClusterState
()
conn
.
answer
(
Packets
.
AnswerClusterState
(
state
))
def
askLastIDs
(
self
,
conn
):
app
=
self
.
app
conn
.
answer
(
Packets
.
AnswerLastIDs
(
app
.
tm
.
getLastOID
(),
app
.
tm
.
getLastTID
(),
app
.
pt
.
getID
(),
app
.
backup_tid
))
def
askLastTransaction
(
self
,
conn
):
conn
.
answer
(
Packets
.
AnswerLastTransaction
(
self
.
app
.
getLastTransaction
()))
def
askNodeInformation
(
self
,
conn
):
nm
=
self
.
app
.
nm
node_list
=
[]
...
...
neo/master/handlers/client.py
View file @
95216790
...
...
@@ -104,10 +104,6 @@ class ClientServiceHandler(MasterHandler):
else
:
conn
.
answer
(
Packets
.
AnswerPack
(
False
))
def
askLastTransaction
(
self
,
conn
):
conn
.
answer
(
Packets
.
AnswerLastTransaction
(
self
.
app
.
getLastTransaction
()))
def
abortTransaction
(
self
,
conn
,
tid
):
self
.
app
.
tm
.
remove
(
conn
.
getUUID
(),
tid
)
neo/master/handlers/storage.py
View file @
95216790
...
...
@@ -49,14 +49,6 @@ class StorageServiceHandler(BaseServiceHandler):
if
app
.
packing
is
not
None
:
self
.
answerPack
(
conn
,
False
)
def
askLastIDs
(
self
,
conn
):
app
=
self
.
app
conn
.
answer
(
Packets
.
AnswerLastIDs
(
app
.
tm
.
getLastOID
(),
app
.
tm
.
getLastTID
(),
app
.
pt
.
getID
(),
app
.
backup_tid
))
def
askUnfinishedTransactions
(
self
,
conn
):
app
=
self
.
app
if
app
.
backup_tid
:
...
...
neo/neoctl/app.py
View file @
95216790
...
...
@@ -16,12 +16,13 @@
from
operator
import
itemgetter
from
.neoctl
import
NeoCTL
,
NotReadyException
from
neo.lib.util
import
bin
,
p64
from
neo.lib.util
import
bin
,
p64
,
u64
from
neo.lib.protocol
import
uuid_str
,
ClusterStates
,
NodeTypes
,
\
UUID_NAMESPACES
,
ZERO_TID
action_dict
=
{
'print'
:
{
'ids'
:
'getLastIds'
,
'pt'
:
'getPartitionRowList'
,
'node'
:
'getNodeList'
,
'cluster'
:
'getClusterState'
,
...
...
@@ -77,6 +78,17 @@ class TerminalNeoCTL(object):
for
node_type
,
address
,
uuid
,
state
in
node_list
)
# Actual actions
def
getLastIds
(
self
,
params
):
"""
Get last ids.
"""
assert
not
params
r
=
self
.
neoctl
.
getLastIds
()
if
r
[
3
]:
return
"last_tid = 0x%x"
%
u64
(
self
.
neoctl
.
getLastTransaction
())
return
"last_oid = 0x%x
\
n
last_tid = 0x%x
\
n
last_ptid = %u"
%
(
u64
(
r
[
0
]),
u64
(
r
[
1
]),
r
[
2
])
def
getPartitionRowList
(
self
,
params
):
"""
Get a list of partition rows, bounded by min & max and involving
...
...
neo/neoctl/handler.py
View file @
95216790
...
...
@@ -59,3 +59,5 @@ class CommandEventHandler(EventHandler):
answerNodeList
=
__answer
(
Packets
.
AnswerNodeList
)
answerClusterState
=
__answer
(
Packets
.
AnswerClusterState
)
answerPrimary
=
__answer
(
Packets
.
AnswerPrimary
)
answerLastIDs
=
__answer
(
Packets
.
AnswerLastIDs
)
answerLastTransaction
=
__answer
(
Packets
.
AnswerLastTransaction
)
neo/neoctl/neoctl.py
View file @
95216790
...
...
@@ -119,6 +119,18 @@ class NeoCTL(object):
raise
RuntimeError
(
response
)
return
response
[
1
]
def
getLastIds
(
self
):
response
=
self
.
__ask
(
Packets
.
AskLastIDs
())
if
response
[
0
]
!=
Packets
.
AnswerLastIDs
:
raise
RuntimeError
(
response
)
return
response
[
1
:]
def
getLastTransaction
(
self
):
response
=
self
.
__ask
(
Packets
.
AskLastTransaction
())
if
response
[
0
]
!=
Packets
.
AnswerLastTransaction
:
raise
RuntimeError
(
response
)
return
response
[
1
]
def
getNodeList
(
self
,
node_type
=
None
):
"""
Get a list of nodes, filtering with given type.
...
...
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