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
Vincent Pelletier
neoppod
Commits
0f049140
Commit
0f049140
authored
Oct 26, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify some code by using 'map()'
parent
cbb992b2
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
15 additions
and
16 deletions
+15
-16
neo/client/app.py
neo/client/app.py
+1
-2
neo/master/handlers/administration.py
neo/master/handlers/administration.py
+3
-3
neo/master/transactions.py
neo/master/transactions.py
+2
-2
neo/master/verification.py
neo/master/verification.py
+1
-1
neo/neoctl/app.py
neo/neoctl/app.py
+1
-1
neo/storage/database/mysqldb.py
neo/storage/database/mysqldb.py
+1
-1
neo/storage/handlers/replication.py
neo/storage/handlers/replication.py
+1
-1
neo/storage/replicator.py
neo/storage/replicator.py
+1
-1
neo/tests/storage/testReplicationHandler.py
neo/tests/storage/testReplicationHandler.py
+3
-3
neo/tests/testProtocol.py
neo/tests/testProtocol.py
+1
-1
No files found.
neo/client/app.py
View file @
0f049140
...
@@ -931,8 +931,7 @@ class Application(object):
...
@@ -931,8 +931,7 @@ class Application(object):
# Reorder tids
# Reorder tids
ordered_tids
=
sorted
(
tid_set
,
reverse
=
True
)
ordered_tids
=
sorted
(
tid_set
,
reverse
=
True
)
neo
.
lib
.
logging
.
debug
(
neo
.
lib
.
logging
.
debug
(
"UndoLog tids %s"
,
map
(
dump
,
ordered_tids
))
"UndoLog tids %s"
,
[
dump
(
x
)
for
x
in
ordered_tids
])
# For each transaction, get info
# For each transaction, get info
undo_info
=
[]
undo_info
=
[]
append
=
undo_info
.
append
append
=
undo_info
.
append
...
...
neo/master/handlers/administration.py
View file @
0f049140
...
@@ -118,7 +118,7 @@ class AdministrationHandler(MasterHandler):
...
@@ -118,7 +118,7 @@ class AdministrationHandler(MasterHandler):
app
.
broadcastNodesInformation
([
node
])
app
.
broadcastNodesInformation
([
node
])
def
addPendingNodes
(
self
,
conn
,
uuid_list
):
def
addPendingNodes
(
self
,
conn
,
uuid_list
):
uuids
=
', '
.
join
(
[
dump
(
uuid
)
for
uuid
in
uuid_list
]
)
uuids
=
', '
.
join
(
map
(
dump
,
uuid_list
)
)
neo
.
lib
.
logging
.
debug
(
'Add nodes %s'
%
uuids
)
neo
.
lib
.
logging
.
debug
(
'Add nodes %s'
%
uuids
)
app
=
self
.
app
app
=
self
.
app
nm
=
app
.
nm
nm
=
app
.
nm
...
@@ -139,10 +139,10 @@ class AdministrationHandler(MasterHandler):
...
@@ -139,10 +139,10 @@ class AdministrationHandler(MasterHandler):
neo
.
lib
.
logging
.
warning
(
'No nodes added'
)
neo
.
lib
.
logging
.
warning
(
'No nodes added'
)
conn
.
answer
(
Errors
.
Ack
(
'No nodes added'
))
conn
.
answer
(
Errors
.
Ack
(
'No nodes added'
))
return
return
uuids
=
', '
.
join
(
[
dump
(
uuid
)
for
uuid
in
uuid_set
]
)
uuids
=
', '
.
join
(
map
(
dump
,
uuid_set
)
)
neo
.
lib
.
logging
.
info
(
'Adding nodes %s'
%
uuids
)
neo
.
lib
.
logging
.
info
(
'Adding nodes %s'
%
uuids
)
# switch nodes to running state
# switch nodes to running state
node_list
=
[
nm
.
getByUUID
(
uuid
)
for
uuid
in
uuid_set
]
node_list
=
map
(
nm
.
getByUUID
,
uuid_set
)
for
node
in
node_list
:
for
node
in
node_list
:
new_cells
=
pt
.
addNode
(
node
)
new_cells
=
pt
.
addNode
(
node
)
cell_list
.
extend
(
new_cells
)
cell_list
.
extend
(
new_cells
)
...
...
neo/master/transactions.py
View file @
0f049140
...
@@ -114,8 +114,8 @@ class Transaction(object):
...
@@ -114,8 +114,8 @@ class Transaction(object):
self
.
__class__
.
__name__
,
self
.
__class__
.
__name__
,
self
.
_node
,
self
.
_node
,
dump
(
self
.
_tid
),
dump
(
self
.
_tid
),
[
dump
(
x
)
for
x
in
self
.
_oid_list
or
()]
,
map
(
dump
,
self
.
_oid_list
or
())
,
[
dump
(
x
)
for
x
in
self
.
_uuid_set
or
()]
,
map
(
dump
,
self
.
_uuid_set
or
())
,
time
()
-
self
.
_birth
,
time
()
-
self
.
_birth
,
id
(
self
),
id
(
self
),
)
)
...
...
neo/master/verification.py
View file @
0f049140
...
@@ -198,7 +198,7 @@ class VerificationManager(BaseServiceHandler):
...
@@ -198,7 +198,7 @@ class VerificationManager(BaseServiceHandler):
def
answerUnfinishedTransactions
(
self
,
conn
,
max_tid
,
tid_list
):
def
answerUnfinishedTransactions
(
self
,
conn
,
max_tid
,
tid_list
):
uuid
=
conn
.
getUUID
()
uuid
=
conn
.
getUUID
()
neo
.
lib
.
logging
.
info
(
'got unfinished transactions %s from %r'
,
neo
.
lib
.
logging
.
info
(
'got unfinished transactions %s from %r'
,
[
dump
(
tid
)
for
tid
in
tid_list
]
,
conn
)
map
(
dump
,
tid_list
)
,
conn
)
if
not
self
.
_gotAnswerFrom
(
uuid
):
if
not
self
.
_gotAnswerFrom
(
uuid
):
return
return
self
.
_tid_set
.
update
(
tid_list
)
self
.
_tid_set
.
update
(
tid_list
)
...
...
neo/neoctl/app.py
View file @
0f049140
...
@@ -167,7 +167,7 @@ class TerminalNeoCTL(object):
...
@@ -167,7 +167,7 @@ class TerminalNeoCTL(object):
node_list
=
self
.
neoctl
.
getNodeList
(
NodeTypes
.
STORAGE
)
node_list
=
self
.
neoctl
.
getNodeList
(
NodeTypes
.
STORAGE
)
uuid_list
=
[
node
[
2
]
for
node
in
node_list
]
uuid_list
=
[
node
[
2
]
for
node
in
node_list
]
else
:
else
:
uuid_list
=
[
self
.
asNode
(
x
)
for
x
in
params
]
uuid_list
=
map
(
self
.
asNode
,
params
)
return
self
.
neoctl
.
enableStorageList
(
uuid_list
)
return
self
.
neoctl
.
enableStorageList
(
uuid_list
)
def
dropNode
(
self
,
params
):
def
dropNode
(
self
,
params
):
...
...
neo/storage/database/mysqldb.py
View file @
0f049140
...
@@ -709,7 +709,7 @@ class MySQLDatabaseManager(DatabaseManager):
...
@@ -709,7 +709,7 @@ class MySQLDatabaseManager(DatabaseManager):
q
=
self
.
query
q
=
self
.
query
r
=
q
(
"""SELECT tid FROM trans WHERE partition in (%s)
r
=
q
(
"""SELECT tid FROM trans WHERE partition in (%s)
ORDER BY tid DESC LIMIT %d,%d"""
\
ORDER BY tid DESC LIMIT %d,%d"""
\
%
(
','
.
join
(
[
str
(
p
)
for
p
in
partition_list
]
),
offset
,
length
))
%
(
','
.
join
(
map
(
str
,
partition_list
)
),
offset
,
length
))
return
[
util
.
p64
(
t
[
0
])
for
t
in
r
]
return
[
util
.
p64
(
t
[
0
])
for
t
in
r
]
def
getReplicationTIDList
(
self
,
min_tid
,
max_tid
,
length
,
num_partitions
,
def
getReplicationTIDList
(
self
,
min_tid
,
max_tid
,
length
,
num_partitions
,
...
...
neo/storage/handlers/replication.py
View file @
0f049140
...
@@ -165,7 +165,7 @@ class ReplicationHandler(EventHandler):
...
@@ -165,7 +165,7 @@ class ReplicationHandler(EventHandler):
for
oid
,
serial
in
missing_object_set
:
for
oid
,
serial
in
missing_object_set
:
if
not
app
.
dm
.
objectPresent
(
oid
,
serial
):
if
not
app
.
dm
.
objectPresent
(
oid
,
serial
):
ask
(
Packets
.
AskObject
(
oid
,
serial
,
None
),
timeout
=
300
)
ask
(
Packets
.
AskObject
(
oid
,
serial
,
None
),
timeout
=
300
)
if
sum
(
(
len
(
x
)
for
x
in
object_dict
.
itervalues
()))
==
MIN_RANGE_LENGTH
:
if
sum
(
map
(
len
,
object_dict
.
itervalues
()))
==
MIN_RANGE_LENGTH
:
max_tid
=
self
.
app
.
replicator
.
getCurrentCriticalTID
()
max_tid
=
self
.
app
.
replicator
.
getCurrentCriticalTID
()
ask
(
self
.
_doAskCheckSerialRange
(
max_oid
,
add64
(
max_serial
,
1
),
ask
(
self
.
_doAskCheckSerialRange
(
max_oid
,
add64
(
max_serial
,
1
),
max_tid
,
RANGE_LENGTH
))
max_tid
,
RANGE_LENGTH
))
...
...
neo/storage/replicator.py
View file @
0f049140
...
@@ -207,7 +207,7 @@ class Replicator(object):
...
@@ -207,7 +207,7 @@ class Replicator(object):
def
setUnfinishedTIDList
(
self
,
max_tid
,
ttid_list
):
def
setUnfinishedTIDList
(
self
,
max_tid
,
ttid_list
):
"""This is a callback from MasterOperationHandler."""
"""This is a callback from MasterOperationHandler."""
neo
.
lib
.
logging
.
debug
(
'setting unfinished TTIDs %s'
,
neo
.
lib
.
logging
.
debug
(
'setting unfinished TTIDs %s'
,
','
.
join
([
dump
(
tid
)
for
tid
in
ttid_list
]
))
','
.
join
(
map
(
dump
,
ttid_list
)
))
# all new outdated partition must wait those ttid
# all new outdated partition must wait those ttid
new_partition_set
=
self
.
new_partition_set
new_partition_set
=
self
.
new_partition_set
while
new_partition_set
:
while
new_partition_set
:
...
...
neo/tests/storage/testReplicationHandler.py
View file @
0f049140
...
@@ -140,8 +140,8 @@ class StorageReplicationHandlerTests(NeoUnitTestBase):
...
@@ -140,8 +140,8 @@ class StorageReplicationHandlerTests(NeoUnitTestBase):
tid_list
.
remove
(
tid
)
tid_list
.
remove
(
tid
)
break
break
else
:
else
:
raise
AssertionFailed
,
'%s not found in %r'
%
(
dump
(
ptid
),
raise
AssertionFailed
(
'%s not found in %r'
[
dump
(
x
)
for
x
in
tid_list
]
)
%
(
dump
(
ptid
),
map
(
dump
,
tid_list
))
)
def
_checkPacketSerialList
(
self
,
conn
,
object_list
,
next_oid
,
next_serial
,
app
):
def
_checkPacketSerialList
(
self
,
conn
,
object_list
,
next_oid
,
next_serial
,
app
):
packet_list
=
[
x
.
getParam
(
0
)
for
x
in
conn
.
mockGetNamedCalls
(
'ask'
)]
packet_list
=
[
x
.
getParam
(
0
)
for
x
in
conn
.
mockGetNamedCalls
(
'ask'
)]
...
@@ -228,7 +228,7 @@ class StorageReplicationHandlerTests(NeoUnitTestBase):
...
@@ -228,7 +228,7 @@ class StorageReplicationHandlerTests(NeoUnitTestBase):
oid_3
=
self
.
getOID
(
3
)
oid_3
=
self
.
getOID
(
3
)
oid_4
=
self
.
getOID
(
4
)
oid_4
=
self
.
getOID
(
4
)
oid_5
=
self
.
getOID
(
5
)
oid_5
=
self
.
getOID
(
5
)
tid_list
=
[
self
.
getOID
(
x
)
for
x
in
xrange
(
7
)]
tid_list
=
map
(
self
.
getOID
,
xrange
(
7
))
oid_dict
=
FakeDict
((
oid_dict
=
FakeDict
((
(
oid_1
,
[
tid_list
[
0
],
tid_list
[
1
]]),
(
oid_1
,
[
tid_list
[
0
],
tid_list
[
1
]]),
(
oid_2
,
[
tid_list
[
2
],
tid_list
[
3
]]),
(
oid_2
,
[
tid_list
[
2
],
tid_list
[
3
]]),
...
...
neo/tests/testProtocol.py
View file @
0f049140
...
@@ -510,7 +510,7 @@ class ProtocolTests(NeoUnitTestBase):
...
@@ -510,7 +510,7 @@ class ProtocolTests(NeoUnitTestBase):
tid
=
self
.
getNextTID
()
tid
=
self
.
getNextTID
()
ltid
=
self
.
getNextTID
()
ltid
=
self
.
getNextTID
()
undone_tid
=
self
.
getNextTID
()
undone_tid
=
self
.
getNextTID
()
oid_list
=
[
self
.
getOID
(
x
)
for
x
in
xrange
(
4
)]
oid_list
=
map
(
self
.
getOID
,
xrange
(
4
))
p
=
Packets
.
AskObjectUndoSerial
(
tid
,
ltid
,
undone_tid
,
oid_list
)
p
=
Packets
.
AskObjectUndoSerial
(
tid
,
ltid
,
undone_tid
,
oid_list
)
ptid
,
pltid
,
pundone_tid
,
poid_list
=
p
.
decode
()
ptid
,
pltid
,
pundone_tid
,
poid_list
=
p
.
decode
()
self
.
assertEqual
(
tid
,
ptid
)
self
.
assertEqual
(
tid
,
ptid
)
...
...
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