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
Iliya Manolov
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
Show 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,21 +982,17 @@ class Application(object):
...
@@ -982,21 +982,17 @@ 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
=
{}
self
.
waitResponses
(
queue
,
history_dict
)
# Now that we have object informations, get txn informations
# Now that we have object informations, get txn informations
history_list
=
[]
result
=
[]
append
=
history_list
.
append
# history_list is already sorted descending (by the storage)
for
serial
in
sorted
(
history_dict
.
keys
(),
reverse
=
True
):
for
serial
,
size
in
history_list
:
size
=
history_dict
[
serial
]
txn_info
,
txn_ext
=
self
.
_getTransactionInformation
(
serial
)
txn_info
,
txn_ext
=
self
.
_getTransactionInformation
(
serial
)
# create history dict
# create history dict
txn_info
.
pop
(
'id'
)
txn_info
.
pop
(
'id'
)
...
@@ -1006,9 +1002,9 @@ class Application(object):
...
@@ -1006,9 +1002,9 @@ class Application(object):
txn_info
[
'version'
]
=
''
txn_info
[
'version'
]
=
''
txn_info
[
'size'
]
=
size
txn_info
[
'size'
]
=
size
if
filter
is
None
or
filter
(
txn_info
):
if
filter
is
None
or
filter
(
txn_info
):
append
(
txn_info
)
result
.
append
(
txn_info
)
self
.
_insertMetadata
(
txn_info
,
txn_ext
)
self
.
_insertMetadata
(
txn_info
,
txn_ext
)
return
history_lis
t
return
resul
t
@
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