Class: Textus::Read::Get

Inherits:
Object
  • Object
show all
Extended by:
Contract::DSL
Defined in:
lib/textus/read/get.rb

Overview

The one read path — a pure read (ADR 0089, 0093): the on-disk envelope annotated with a freshness annotation. It NEVER mutates and NEVER ingests. Quarantine freshness is system-pushed via ‘reconcile` (scheduled sweep) and `hook run` (event push). Lifecycle is removed from the get path (ADR 0093): intake cadence lives in `source.ttl`; GC lives in `retention:` rules; both are evaluated exclusively by the `reconcile` sweep, not by a read.

Instance Method Summary collapse

Methods included from Contract::DSL

arg, around, cli, cli_stdin, contract, contract?, summary, surfaces, verb, view

Constructor Details

#initialize(container:, call:, file_stat: Textus::Ports::Storage::FileStat.new) ⇒ Get

Returns a new instance of Get.



22
23
24
25
26
27
28
# File 'lib/textus/read/get.rb', line 22

def initialize(container:, call:, file_stat: Textus::Ports::Storage::FileStat.new)
  @container  = container
  @call       = call
  @manifest   = container.manifest
  @file_store = container.file_store
  @file_stat  = file_stat
end

Instance Method Details

#call(key) ⇒ Object



30
31
32
# File 'lib/textus/read/get.rb', line 30

def call(key)
  annotated_envelope(key)
end

#get(key) ⇒ Object

Strict variant: raises UnknownKey when the entry is missing. Used by consumers (e.g. uid, Validator) that distinguish absence.



36
37
38
39
# File 'lib/textus/read/get.rb', line 36

def get(key)
  call(key) ||
    raise(UnknownKey.new(key, suggestions: @manifest.resolver.suggestions_for(key)))
end