Class: Hecks::Adapters::Lambda
- Inherits:
-
Object
- Object
- Hecks::Adapters::Lambda
- Includes:
- Ports::Persistence::RemoteRuntime
- Defined in:
- lib/hecks/adapters/driven/lambda.rb,
lib/hecks/adapters/driven/lambda/client.rb
Overview
THE READ-SIDE HALF OF LAMBDA ROUTING — persisted_by("Lambda")'s
own adapter, resolved through the SAME Ports::Persistence
machinery persisted_by("Postgres")/persisted_by("Memory")
already use (Runtime::Registry#repository, RepositoryFactory .build) — no new framework plumbing, just a new adapter class at
the name the existing lookup already expects. See
Runtime::RemoteDispatcher for the write-side half; the two
compose through one shared Client per domain rather than each
inventing its own AWS wiring.
READ-ONLY, DELIBERATELY — append/project raise rather than
silently no-op. A write reaching this class would mean
Runtime::CommandInterpreter ran locally against a Lambda-routed
domain, which is exactly the bypass Runtime::RemoteDispatcher
exists to prevent (business-rule validation must happen in Rust
for these domains, not be pre-computed here against an
incomplete local view). A loud failure here is the correct
outcome, not a bug to route around.
Defined Under Namespace
Classes: Client
Instance Attribute Summary collapse
-
#aggregate ⇒ Object
readonly
Returns the value of attribute aggregate.
Instance Method Summary collapse
- #all(order_by: nil, direction: :asc) ⇒ Object
- #count ⇒ Object
- #find(id) ⇒ Object
-
#initialize(aggregate:, settings: {}, root: nil) ⇒ Lambda
constructor
A new instance of Lambda.
- #query(specification, args = {}, context: {}) ⇒ Object
Methods included from Ports::Persistence::RemoteRuntime
Constructor Details
#initialize(aggregate:, settings: {}, root: nil) ⇒ Lambda
Returns a new instance of Lambda.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/hecks/adapters/driven/lambda.rb', line 32 def initialize(aggregate:, settings: {}, root: nil) @aggregate = aggregate domain = settings[:domain] || settings["domain"] || aggregate.name region = settings[:region] || settings["region"] || "us-east-1" # TWO DIFFERENT "domain"s, deliberately not conflated: `domain` # (this aggregate's OWN bluebook name — "Identity", "Governance") # only ever prefixes the instances lookup, since that's how # rust/host's own `Store::instances()` keys every record # (`registry.rb`'s own `"#{a[:domain_name]}::#{a[:name]}#"` # dump format, unchanged by which chapter attached it). The # FUNCTION to actually call is a different question: Governance # and Identity aggregates are compiled into the ATTACHING # domain's own Lambda (one merged `Store` per target — Phase 0's # framework-bluebook work), never a function of their own, so # `settings[:domain]` is the wrong signal for `Client.new`. # `root` is the boot's own directory (`Registry#root`, shared by # EVERY bluebook in one registry regardless of which one # attached it) — `File.basename(root)` reproduces the exact # same string `bin/project_deploy`'s own `stack_name` computes # from the domain PATH, so the two can never name two # different functions for the same deploy... on a LOCAL boot, # where `root` is a real project directory. Inside the deployed # Lambda itself `root` is ALWAYS `/var/task` (every Lambda's own # fixed code root, regardless of domain) — `File.basename` gives # "task", not the domain name, and invokes the wrong function # entirely. A real, live AccessDeniedException on # "hecks-task" caught this: invisible through every earlier # phase's own verify step, all run from a local boot, until # WebFunction became the first Ruby process to EVER make this # exact call from inside a deployed Lambda. `DOMAIN_NAME` (set # by bin/project_deploy's own WebFunction Environment) is the # real, unambiguous signal in that specific context; the # root-basename heuristic stays as the local-boot fallback, # unchanged. function_domain = ENV["DOMAIN_NAME"] || (root ? File.basename(root) : domain) @client = Client.new(domain: function_domain, region: region) @prefix = "#{domain}::#{aggregate.hecks_name}#" end |
Instance Attribute Details
#aggregate ⇒ Object (readonly)
Returns the value of attribute aggregate.
30 31 32 |
# File 'lib/hecks/adapters/driven/lambda.rb', line 30 def aggregate @aggregate end |
Instance Method Details
#all(order_by: nil, direction: :asc) ⇒ Object
75 76 77 |
# File 'lib/hecks/adapters/driven/lambda.rb', line 75 def all(order_by: nil, direction: :asc) InMemoryOrdering.ordered(instances.values, aggregate: @aggregate, order_by: order_by, direction: direction) end |
#count ⇒ Object
79 |
# File 'lib/hecks/adapters/driven/lambda.rb', line 79 def count = instances.size |
#find(id) ⇒ Object
71 72 73 |
# File 'lib/hecks/adapters/driven/lambda.rb', line 71 def find(id) instances[id.to_s] end |