Class: Textus::Store::Container
- Inherits:
-
Object
- Object
- Textus::Store::Container
- Defined in:
- lib/textus/store/container.rb
Defined Under Namespace
Classes: Coordination, Infrastructure
Instance Attribute Summary collapse
-
#coord ⇒ Object
readonly
Returns the value of attribute coord.
-
#infra ⇒ Object
readonly
Returns the value of attribute infra.
-
#pipeline ⇒ Object
readonly
Returns the value of attribute pipeline.
-
#reader ⇒ Object
readonly
Returns the value of attribute reader.
-
#writer ⇒ Object
readonly
Returns the value of attribute writer.
Class Method Summary collapse
- .attribute_names ⇒ Object
- .build(infra, coord_seed) ⇒ Object
- .create_writer_factory(container) ⇒ Object
- .freshness_evaluator(container) ⇒ Object
- .orchestration_for(container) ⇒ Object
Instance Method Summary collapse
-
#initialize(infra, coord) ⇒ Container
constructor
A new instance of Container.
- #root ⇒ Object
- #wire!(pipeline:, reader:, writer:) ⇒ Object
Constructor Details
#initialize(infra, coord) ⇒ Container
Returns a new instance of Container.
11 12 13 14 |
# File 'lib/textus/store/container.rb', line 11 def initialize(infra, coord) @infra = infra @coord = coord end |
Instance Attribute Details
#coord ⇒ Object (readonly)
Returns the value of attribute coord.
16 17 18 |
# File 'lib/textus/store/container.rb', line 16 def coord @coord end |
#infra ⇒ Object (readonly)
Returns the value of attribute infra.
16 17 18 |
# File 'lib/textus/store/container.rb', line 16 def infra @infra end |
#pipeline ⇒ Object (readonly)
Returns the value of attribute pipeline.
16 17 18 |
# File 'lib/textus/store/container.rb', line 16 def pipeline @pipeline end |
#reader ⇒ Object (readonly)
Returns the value of attribute reader.
16 17 18 |
# File 'lib/textus/store/container.rb', line 16 def reader @reader end |
#writer ⇒ Object (readonly)
Returns the value of attribute writer.
16 17 18 |
# File 'lib/textus/store/container.rb', line 16 def writer @writer end |
Class Method Details
.attribute_names ⇒ Object
7 8 9 |
# File 'lib/textus/store/container.rb', line 7 def self.attribute_names @attribute_names ||= [:root] + Infrastructure.members + Coordination.members end |
.build(infra, coord_seed) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/textus/store/container.rb', line 42 def self.build(infra, coord_seed) coord = Coordination.new( manifest: coord_seed.manifest, workflows: coord_seed.workflows, pipeline: nil, ) container = new(infra, coord) pipeline = build_pipeline(container) reader = Textus::Store::Entry::Reader.from(container: container) writer = create_writer_factory(container) container.wire!(pipeline: pipeline, reader: reader, writer: writer) end |
.create_writer_factory(container) ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/textus/store/container.rb', line 150 def self.create_writer_factory(container) lambda do |call| Textus::Store::Entry::Writer.new( file_store: container.file_store, manifest: container.manifest, schemas: container.schemas, audit_log: container.audit_log, call: call, reader: container.reader, layout: container.layout, ) end end |
.freshness_evaluator(container) ⇒ Object
164 165 166 167 168 169 170 |
# File 'lib/textus/store/container.rb', line 164 def self.freshness_evaluator(container) Store::Freshness::TtlEvaluator.new( manifest: container.manifest, file_stat: Textus::Port::Storage::FileStat.new, clock: Textus::Port::Clock.new, ) end |
.orchestration_for(container) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/textus/store/container.rb', line 55 def self.orchestration_for(container) Orchestration.new( list_keys: Handlers::Read::ListKeys.new(manifest: container.manifest, job_store: container.job_store), move_key: Handlers::Write::MoveKey.new(container: container, manifest: container.manifest), delete_key: Handlers::Write::DeleteKey.new(container: container), audit_entries: Handlers::Read::AuditEntries.new(manifest: container.manifest, audit_log: container.audit_log), ) end |
Instance Method Details
#root ⇒ Object
18 19 20 |
# File 'lib/textus/store/container.rb', line 18 def root @infra.layout.root end |
#wire!(pipeline:, reader:, writer:) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/textus/store/container.rb', line 30 def wire!(pipeline:, reader:, writer:) @pipeline = pipeline @reader = reader @writer = writer @coord = Coordination.new( manifest: @coord.manifest, workflows: @coord.workflows, pipeline: pipeline, ) self end |