Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
ca7f78c0
Commit
ca7f78c0
authored
Apr 08, 2013
by
Stavros Sachtouris
Browse files
fixbug 3555: blcks missing if same to other blcks
parent
d187ba37
Changes
1
Hide whitespace changes
Inline
Side-by-side
kamaki/clients/pithos/__init__.py
View file @
ca7f78c0
...
...
@@ -408,7 +408,11 @@ class PithosClient(PithosRestClient):
#assert total_size/blocksize + 1 == len(hashmap['hashes'])
map_dict
=
{}
for
i
,
h
in
enumerate
(
hashmap
[
'hashes'
]):
map_dict
[
h
]
=
i
# map_dict[h] = i CHAGE
if
h
in
map_dict
:
map_dict
[
h
].
append
(
i
)
else
:
map_dict
[
h
]
=
[
i
]
return
(
blocksize
,
blockhash
,
total_size
,
hashmap
[
'hashes'
],
map_dict
)
def
_dump_blocks_sync
(
...
...
@@ -470,26 +474,28 @@ class PithosClient(PithosRestClient):
offset
=
rstart
if
blocksize
>
rstart
else
rstart
%
blocksize
self
.
_init_thread_limit
()
for
block_hash
,
blockid
in
remote_hashes
.
items
():
start
=
blocksize
*
blockid
if
start
<
file_size
and
block_hash
==
self
.
_hash_from_file
(
local_file
,
start
,
blocksize
,
blockhash
):
self
.
_cb_next
()
continue
self
.
_watch_thread_limit
(
flying
.
values
())
finished
+=
self
.
_thread2file
(
flying
,
local_file
,
offset
,
**
restargs
)
end
=
total_size
-
1
if
start
+
blocksize
>
total_size
\
else
start
+
blocksize
-
1
(
start
,
end
)
=
_range_up
(
start
,
end
,
filerange
)
if
start
==
end
:
self
.
_cb_next
()
continue
restargs
[
'async_headers'
]
=
{
'Range'
:
'bytes=%s-%s'
%
(
start
,
end
)}
flying
[
start
]
=
self
.
_get_block_async
(
obj
,
**
restargs
)
for
block_hash
,
blockids
in
remote_hashes
.
items
():
for
blockid
in
blockids
:
start
=
blocksize
*
blockid
if
start
<
file_size
and
block_hash
==
self
.
_hash_from_file
(
local_file
,
start
,
blocksize
,
blockhash
):
self
.
_cb_next
()
continue
self
.
_watch_thread_limit
(
flying
.
values
())
finished
+=
self
.
_thread2file
(
flying
,
local_file
,
offset
,
**
restargs
)
end
=
total_size
-
1
if
start
+
blocksize
>
total_size
\
else
start
+
blocksize
-
1
(
start
,
end
)
=
_range_up
(
start
,
end
,
filerange
)
if
start
==
end
:
self
.
_cb_next
()
continue
restargs
[
'async_headers'
]
=
{
'Range'
:
'bytes=%s-%s'
%
(
start
,
end
)}
flying
[
start
]
=
self
.
_get_block_async
(
obj
,
**
restargs
)
for
thread
in
flying
.
values
():
thread
.
join
()
...
...
@@ -543,7 +549,7 @@ class PithosClient(PithosRestClient):
assert
total_size
>=
0
if
download_cb
:
self
.
progress_bar_gen
=
download_cb
(
len
(
remote_hashes
))
self
.
progress_bar_gen
=
download_cb
(
len
(
hash_list
))
self
.
_cb_next
()
if
dst
.
isatty
():
...
...
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