Skip to content
Snippets Groups Projects
Commit 8dff8818 authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

docstrings

parent 14f63db4
No related branches found
No related tags found
1 merge request!52Check passes in add_lease
......@@ -480,6 +480,13 @@ def get_share_sizes(storage_server, storage_index_or_slot, sharenums):
def get_storage_index_share_size(sharepath):
"""
Get the size of a share belonging to a storage index (an immutable share).
:param bytes sharepath: The path to the share file.
:return int: The data size of the share in bytes.
"""
with open(sharepath) as share_file:
share_data_length_bytes = share_file.read(8)[4:]
(share_data_length,) = unpack('>L', share_data_length_bytes)
......@@ -487,6 +494,13 @@ def get_storage_index_share_size(sharepath):
def get_slot_share_size(sharepath):
"""
Get the size of a share belonging to a slot (a mutable share).
:param bytes sharepath: The path to the share file.
:return int: The data size of the share in bytes.
"""
with open(sharepath) as share_file:
share_data_length_bytes = share_file.read(92)[-8:]
(share_data_length,) = unpack('>Q', share_data_length_bytes)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment