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
Jérome Perrin
neoppod
Commits
df47e5b1
Commit
df47e5b1
authored
Sep 15, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client: optimize Storage.history() by not asking all storages systematically
parent
11473bff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
22 deletions
+18
-22
neo/client/app.py
neo/client/app.py
+17
-21
neo/client/handlers/storage.py
neo/client/handlers/storage.py
+1
-1
No files found.
neo/client/app.py
View file @
df47e5b1
...
@@ -982,33 +982,29 @@ class Application(object):
...
@@ -982,33 +982,29 @@ class Application(object):
return
(
tid
,
txn_list
)
return
(
tid
,
txn_list
)
def
history
(
self
,
oid
,
size
=
1
,
filter
=
None
):
def
history
(
self
,
oid
,
size
=
1
,
filter
=
None
):
queue
=
self
.
_getThreadQueue
()
# Get history informations for object first
# Get history informations for object first
packet
=
Packets
.
AskObjectHistory
(
oid
,
0
,
size
)
packet
=
Packets
.
AskObjectHistory
(
oid
,
0
,
size
)
for
node
,
conn
in
self
.
cp
.
iterateForObject
(
oid
,
readable
=
True
):
for
node
,
conn
in
self
.
cp
.
iterateForObject
(
oid
,
readable
=
True
):
try
:
try
:
conn
.
ask
(
packet
,
queue
=
queue
)
history_list
=
self
.
_askStorage
(
conn
,
packet
)
except
ConnectionClosed
:
except
ConnectionClosed
:
continue
continue
history_dict
=
{}
# Now that we have object informations, get txn informations
self
.
waitResponses
(
queue
,
history_dict
)
result
=
[]
# Now that we have object informations, get txn informations
# history_list is already sorted descending (by the storage)
history_list
=
[]
for
serial
,
size
in
history_list
:
append
=
history_list
.
append
txn_info
,
txn_ext
=
self
.
_getTransactionInformation
(
serial
)
for
serial
in
sorted
(
history_dict
.
keys
(),
reverse
=
True
):
# create history dict
size
=
history_dict
[
serial
]
txn_info
.
pop
(
'id'
)
txn_info
,
txn_ext
=
self
.
_getTransactionInformation
(
serial
)
txn_info
.
pop
(
'oids'
)
# create history dict
txn_info
.
pop
(
'packed'
)
txn_info
.
pop
(
'id'
)
txn_info
[
'tid'
]
=
serial
txn_info
.
pop
(
'oids'
)
txn_info
[
'version'
]
=
''
txn_info
.
pop
(
'packed'
)
txn_info
[
'size'
]
=
size
txn_info
[
'tid'
]
=
serial
if
filter
is
None
or
filter
(
txn_info
):
txn_info
[
'version'
]
=
''
result
.
append
(
txn_info
)
txn_info
[
'size'
]
=
size
self
.
_insertMetadata
(
txn_info
,
txn_ext
)
if
filter
is
None
or
filter
(
txn_info
):
return
result
append
(
txn_info
)
self
.
_insertMetadata
(
txn_info
,
txn_ext
)
return
history_list
@
profiler_decorator
@
profiler_decorator
def
importFrom
(
self
,
source
,
start
,
stop
,
tryToResolveConflict
):
def
importFrom
(
self
,
source
,
start
,
stop
,
tryToResolveConflict
):
...
...
neo/client/handlers/storage.py
View file @
df47e5b1
...
@@ -122,7 +122,7 @@ class StorageAnswersHandler(AnswerBaseHandler):
...
@@ -122,7 +122,7 @@ class StorageAnswersHandler(AnswerBaseHandler):
def
answerObjectHistory
(
self
,
conn
,
_
,
history_list
):
def
answerObjectHistory
(
self
,
conn
,
_
,
history_list
):
# history_list is a list of tuple (serial, size)
# history_list is a list of tuple (serial, size)
self
.
app
.
getHandlerData
().
update
(
history_list
)
self
.
app
.
setHandlerData
(
history_list
)
def
oidNotFound
(
self
,
conn
,
message
):
def
oidNotFound
(
self
,
conn
,
message
):
# This can happen either when :
# This can happen either when :
...
...
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