Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
nexedi
/
neoppod
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
2
Snippets
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 2d35ac93
authored
2012-01-05 12:06:29 +0100
by
Vincent Pelletier
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Stop using assertions for actual runtime checks.
1 parent
c93a786f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
neo/neoctl/neoctl.py
neo/neoctl/neoctl.py
View file @
2d35ac9
...
...
@@ -78,8 +78,8 @@ class NeoCTL(object):
"""
packet
=
Packets
.
AddPendingNodes
(
uuid_list
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
Error
assert
response
[
1
]
==
ErrorCodes
.
ACK
if
response
[
0
]
!=
Packets
.
Error
or
response
[
1
]
!=
ErrorCodes
.
ACK
:
raise
RuntimeError
(
response
)
return
response
[
2
]
def
setClusterState
(
self
,
state
):
...
...
@@ -88,8 +88,8 @@ class NeoCTL(object):
"""
packet
=
Packets
.
SetClusterState
(
state
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
Error
assert
response
[
1
]
==
ErrorCodes
.
ACK
if
response
[
0
]
!=
Packets
.
Error
or
response
[
1
]
!=
ErrorCodes
.
ACK
:
raise
RuntimeError
(
response
)
return
response
[
2
]
def
setNodeState
(
self
,
node
,
state
,
update_partition_table
=
False
):
...
...
@@ -102,8 +102,8 @@ class NeoCTL(object):
update_partition_table
=
0
packet
=
Packets
.
SetNodeState
(
node
,
state
,
update_partition_table
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
Error
assert
response
[
1
]
==
ErrorCodes
.
ACK
if
response
[
0
]
!=
Packets
.
Error
or
response
[
1
]
!=
ErrorCodes
.
ACK
:
raise
RuntimeError
(
response
)
return
response
[
2
]
def
getClusterState
(
self
):
...
...
@@ -112,7 +112,8 @@ class NeoCTL(object):
"""
packet
=
Packets
.
AskClusterState
()
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
AnswerClusterState
if
response
[
0
]
!=
Packets
.
AnswerClusterState
:
raise
RuntimeError
(
response
)
return
response
[
1
]
def
getNodeList
(
self
,
node_type
=
None
):
...
...
@@ -121,7 +122,8 @@ class NeoCTL(object):
"""
packet
=
Packets
.
AskNodeList
(
node_type
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
AnswerNodeList
if
response
[
0
]
!=
Packets
.
AnswerNodeList
:
raise
RuntimeError
(
response
)
return
response
[
1
]
# node_list
def
getPartitionRowList
(
self
,
min_offset
=
0
,
max_offset
=
0
,
node
=
None
):
...
...
@@ -131,7 +133,8 @@ class NeoCTL(object):
"""
packet
=
Packets
.
AskPartitionList
(
min_offset
,
max_offset
,
node
)
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
AnswerPartitionList
if
response
[
0
]
!=
Packets
.
AnswerPartitionList
:
raise
RuntimeError
(
response
)
return
response
[
1
:
3
]
# ptid, row_list
def
startCluster
(
self
):
...
...
@@ -153,6 +156,7 @@ class NeoCTL(object):
"""
packet
=
Packets
.
AskPrimary
()
response
=
self
.
__ask
(
packet
)
assert
response
[
0
]
==
Packets
.
AnswerPrimary
if
response
[
0
]
!=
Packets
.
AnswerPrimary
:
raise
RuntimeError
(
response
)
return
response
[
1
]
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment