Class: Ea::Spa::Output::ShardedMultiFileStrategy

Inherits:
Strategy
  • Object
show all
Defined in:
lib/ea/spa/output/sharded_multi_file_strategy.rb

Overview

Sharded layout: directory with skeleton.json, search.json, and one JSON file per entity under data/. The frontend loads skeleton + search upfront and fetches shards on demand. This is the layout for large models.

Constant Summary

Constants inherited from Strategy

Ea::Spa::Output::Strategy::SIZE_THRESHOLD_BYTES

Instance Attribute Summary

Attributes inherited from Strategy

#output_path

Instance Method Summary collapse

Methods inherited from Strategy

#initialize

Constructor Details

This class inherits a constructor from Ea::Spa::Output::Strategy

Instance Method Details

#render(projector) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ea/spa/output/sharded_multi_file_strategy.rb', line 13

def render(projector)
  FileUtils.mkdir_p(output_path)
  FileUtils.mkdir_p(File.join(output_path, "data"))

  skeleton = projector.skeleton
  write_json(File.join(output_path, "skeleton.json"), skeleton)
  write_json(File.join(output_path, "search.json"),
             projector.search_index)
  write_shards(projector)
  write_index_html(skeleton)

  output_path
end