Class: Arv::Collection::StreamManifest

Inherits:
Object
  • Object
show all
Defined in:
lib/arvados/collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ StreamManifest

Build a manifest text for a single stream, without substreams. The manifest includes files in the order they’re added. If you want a normalized manifest, add files in lexical order by name.



474
475
476
477
478
479
# File 'lib/arvados/collection.rb', line 474

def initialize(name)
  @name = name
  @loc_ranges = {}
  @loc_range_start = 0
  @file_specs = []
end

Instance Method Details

#add_file(coll_file) ⇒ Object



481
482
483
484
485
486
# File 'lib/arvados/collection.rb', line 481

def add_file(coll_file)
  coll_file.each_segment do |segment|
    extend_locator_ranges(segment.locators)
    extend_file_specs(coll_file.name, segment)
  end
end

#to_sObject



488
489
490
491
492
493
494
495
496
# File 'lib/arvados/collection.rb', line 488

def to_s
  if @file_specs.empty?
    ""
  else
    "%s %s %s\n" % [escape_name(@name),
                    @loc_ranges.keys.join(" "),
                    @file_specs.join(" ")]
  end
end