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
2d35ac93
Commit
2d35ac93
authored
Jan 05, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop using assertions for actual runtime checks.
parent
c93a786f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
neo/neoctl/neoctl.py
neo/neoctl/neoctl.py
+14
-10
No files found.
neo/neoctl/neoctl.py
View file @
2d35ac93
...
@@ -78,8 +78,8 @@ class NeoCTL(object):
...
@@ -78,8 +78,8 @@ class NeoCTL(object):
"""
"""
packet
=
Packets
.
AddPendingNodes
(
uuid_list
)
packet
=
Packets
.
AddPendingNodes
(
uuid_list
)
response
=
self
.
__ask
(
packet
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
Error
if
response
[
0
]
!=
Packets
.
Error
or
response
[
1
]
!=
ErrorCodes
.
ACK
:
assert
response
[
1
]
==
ErrorCodes
.
ACK
raise
RuntimeError
(
response
)
return
response
[
2
]
return
response
[
2
]
def
setClusterState
(
self
,
state
):
def
setClusterState
(
self
,
state
):
...
@@ -88,8 +88,8 @@ class NeoCTL(object):
...
@@ -88,8 +88,8 @@ class NeoCTL(object):
"""
"""
packet
=
Packets
.
SetClusterState
(
state
)
packet
=
Packets
.
SetClusterState
(
state
)
response
=
self
.
__ask
(
packet
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
Error
if
response
[
0
]
!=
Packets
.
Error
or
response
[
1
]
!=
ErrorCodes
.
ACK
:
assert
response
[
1
]
==
ErrorCodes
.
ACK
raise
RuntimeError
(
response
)
return
response
[
2
]
return
response
[
2
]
def
setNodeState
(
self
,
node
,
state
,
update_partition_table
=
False
):
def
setNodeState
(
self
,
node
,
state
,
update_partition_table
=
False
):
...
@@ -102,8 +102,8 @@ class NeoCTL(object):
...
@@ -102,8 +102,8 @@ class NeoCTL(object):
update_partition_table
=
0
update_partition_table
=
0
packet
=
Packets
.
SetNodeState
(
node
,
state
,
update_partition_table
)
packet
=
Packets
.
SetNodeState
(
node
,
state
,
update_partition_table
)
response
=
self
.
__ask
(
packet
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
Error
if
response
[
0
]
!=
Packets
.
Error
or
response
[
1
]
!=
ErrorCodes
.
ACK
:
assert
response
[
1
]
==
ErrorCodes
.
ACK
raise
RuntimeError
(
response
)
return
response
[
2
]
return
response
[
2
]
def
getClusterState
(
self
):
def
getClusterState
(
self
):
...
@@ -112,7 +112,8 @@ class NeoCTL(object):
...
@@ -112,7 +112,8 @@ class NeoCTL(object):
"""
"""
packet
=
Packets
.
AskClusterState
()
packet
=
Packets
.
AskClusterState
()
response
=
self
.
__ask
(
packet
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
AnswerClusterState
if
response
[
0
]
!=
Packets
.
AnswerClusterState
:
raise
RuntimeError
(
response
)
return
response
[
1
]
return
response
[
1
]
def
getNodeList
(
self
,
node_type
=
None
):
def
getNodeList
(
self
,
node_type
=
None
):
...
@@ -121,7 +122,8 @@ class NeoCTL(object):
...
@@ -121,7 +122,8 @@ class NeoCTL(object):
"""
"""
packet
=
Packets
.
AskNodeList
(
node_type
)
packet
=
Packets
.
AskNodeList
(
node_type
)
response
=
self
.
__ask
(
packet
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
AnswerNodeList
if
response
[
0
]
!=
Packets
.
AnswerNodeList
:
raise
RuntimeError
(
response
)
return
response
[
1
]
# node_list
return
response
[
1
]
# node_list
def
getPartitionRowList
(
self
,
min_offset
=
0
,
max_offset
=
0
,
node
=
None
):
def
getPartitionRowList
(
self
,
min_offset
=
0
,
max_offset
=
0
,
node
=
None
):
...
@@ -131,7 +133,8 @@ class NeoCTL(object):
...
@@ -131,7 +133,8 @@ class NeoCTL(object):
"""
"""
packet
=
Packets
.
AskPartitionList
(
min_offset
,
max_offset
,
node
)
packet
=
Packets
.
AskPartitionList
(
min_offset
,
max_offset
,
node
)
response
=
self
.
__ask
(
packet
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
AnswerPartitionList
if
response
[
0
]
!=
Packets
.
AnswerPartitionList
:
raise
RuntimeError
(
response
)
return
response
[
1
:
3
]
# ptid, row_list
return
response
[
1
:
3
]
# ptid, row_list
def
startCluster
(
self
):
def
startCluster
(
self
):
...
@@ -153,6 +156,7 @@ class NeoCTL(object):
...
@@ -153,6 +156,7 @@ class NeoCTL(object):
"""
"""
packet
=
Packets
.
AskPrimary
()
packet
=
Packets
.
AskPrimary
()
response
=
self
.
__ask
(
packet
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
AnswerPrimary
if
response
[
0
]
!=
Packets
.
AnswerPrimary
:
raise
RuntimeError
(
response
)
return
response
[
1
]
return
response
[
1
]
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