Class: Textus::Protocol::Builder::Runtime

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/protocol/builder/runtime.rb

Defined Under Namespace

Classes: Components

Instance Method Summary collapse

Instance Method Details

#call(infra:, domain:, root:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/textus/protocol/builder/runtime.rb', line 7

def call(infra:, domain:, root:)
  event_emitter = Textus::Workflow::EventEmitter.new(
    infra.store.workflow_queue,
    registry: domain.workflow_registry,
  )

  store_engine = StoreEngine.new(
    file_system: infra.file_system, manifest: domain.manifest,
    layout: infra.layout, store: infra.store,
    event_emitter:, schemas: domain.schemas
  )

  ttl_evaluator = Freshness::TtlEvaluator.new(
    manifest: domain.manifest,
    file_stat: infra.file_system,
    clock: Infra::Clock.new,
  )

  container = Container.new(
    store: infra.store, layout: infra.layout,
    manifest: domain.manifest, schemas: domain.schemas,
    workflows: domain.workflows,
    store_engine: store_engine,
    root:, ttl_evaluator:
  )

  gate = Gate.new(
    manifest: domain.manifest,
    resolver: domain.manifest.resolver,
    container:,
    store_engine:,
  )

  container.gate = gate
  Components.new(store_engine:, gate:, ttl_evaluator:, container:)
end