projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
5414: Merge branch 'master' into 5414-keep-service-hints
[arvados.git]
/
sdk
/
ruby
/
lib
/
arvados
/
keep.rb
diff --git
a/sdk/ruby/lib/arvados/keep.rb
b/sdk/ruby/lib/arvados/keep.rb
index f28cfdc3808bf741be22d3873bc8702def383984..e4f62083b0d5568d757d8ae05dc043170e10f6ca 100644
(file)
--- a/
sdk/ruby/lib/arvados/keep.rb
+++ b/
sdk/ruby/lib/arvados/keep.rb
@@
-138,7
+138,10
@@
module Keep
def split_file_token token
start_pos, filesize, filename = token.split(':', 3)
def split_file_token token
start_pos, filesize, filename = token.split(':', 3)
- [start_pos.to_i, filesize.to_i, filename]
+ if filename.nil?
+ raise ArgumentError.new "Invalid file token '#{token}'"
+ end
+ [start_pos.to_i, filesize.to_i, unescape(filename)]
end
def each_file_spec
end
def each_file_spec
@@
-188,6
+191,11
@@
module Keep
seen_files.size
end
seen_files.size
end
+ def files_size
+ # Return the total size of all files in this manifest.
+ files.reduce(0) { |total, (_, _, size)| total + size }
+ end
+
def exact_file_count?(want_count)
files_count(want_count + 1) == want_count
end
def exact_file_count?(want_count)
files_count(want_count + 1) == want_count
end