pub fn part_layout(field: &str, size: u64, max_part: u64) -> Result<(u64, u16)>Expand description
How to cut size bytes into parts no larger than max_part: (part_size, part_count).
§Errors
Error::Invalid on field when the file needs parts over max_part.
§Examples
use ocre::storage::{MAX_WORKER_PART, PART_SIZE, part_layout};
assert_eq!(part_layout("video", 25 * 1024 * 1024, MAX_WORKER_PART).unwrap(), (PART_SIZE, 3));
assert_eq!(part_layout("video", 0, MAX_WORKER_PART).unwrap(), (PART_SIZE, 1));