Class: Legion::Extensions::Llm::Inventory::Publisher
- Inherits:
-
Object
- Object
- Legion::Extensions::Llm::Inventory::Publisher
- Includes:
- Logging::Helper
- Defined in:
- lib/legion/extensions/llm/inventory/publisher.rb
Overview
Provider-facing direct wrapper over the local Registry. It constructs and validates the exact InstanceKey from its fixed provider family and delegates to the registry with the exact kwargs. It does no retries, selection, scheduling, defaulting, provider discovery, or exception swallowing beyond the explicitly injected, best-effort post-commit old-coordinator projection. See phase-1-lex-llm-additive.md section 13.1.
Instance Method Summary collapse
- #activate_instance_snapshot(instance_id:, publisher_token:, offerings:, sequence:, probe_token:) ⇒ Object
- #claim_instance(instance_id:, callable:, probe_request_handle:) ⇒ Object
-
#initialize(provider_family:, registry: Registry, compatibility_adapter: nil) ⇒ Publisher
constructor
A new instance of Publisher.
- #readiness_failed(instance_id:, probe_token:, reason:) ⇒ Object
- #readiness_probe_started(instance_id:, publisher_token:) ⇒ Object
- #readiness_succeeded(instance_id:, probe_token:) ⇒ Object
- #remove_instance(instance_id:, publisher_token:) ⇒ Object
- #replace_instance_snapshot(instance_id:, publisher_token:, offerings:, sequence:) ⇒ Object
- #snapshot ⇒ Object
Constructor Details
#initialize(provider_family:, registry: Registry, compatibility_adapter: nil) ⇒ Publisher
Returns a new instance of Publisher.
21 22 23 24 25 |
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 21 def initialize(provider_family:, registry: Registry, compatibility_adapter: nil) @provider_family = provider_family @registry = registry @compatibility_adapter = compatibility_adapter end |
Instance Method Details
#activate_instance_snapshot(instance_id:, publisher_token:, offerings:, sequence:, probe_token:) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 38 def activate_instance_snapshot(instance_id:, publisher_token:, offerings:, sequence:, probe_token:) key = instance_key(instance_id) result = @registry.activate_instance_snapshot( publisher_token: publisher_token, instance_key: key, offerings: offerings, sequence: sequence, probe_token: probe_token ) sync_applied(key, result) end |
#claim_instance(instance_id:, callable:, probe_request_handle:) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 27 def claim_instance(instance_id:, callable:, probe_request_handle:) key = instance_key(instance_id) token = @registry.claim_instance(instance_key: key, callable: callable, probe_request_handle: probe_request_handle) sync_compatibility(key, :claimed) token end |
#readiness_failed(instance_id:, probe_token:, reason:) ⇒ Object
60 61 62 63 |
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 60 def readiness_failed(instance_id:, probe_token:, reason:) key = instance_key(instance_id) sync_applied(key, @registry.readiness_failed(instance_key: key, probe_token: probe_token, reason: reason)) end |
#readiness_probe_started(instance_id:, publisher_token:) ⇒ Object
34 35 36 |
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 34 def readiness_probe_started(instance_id:, publisher_token:) @registry.readiness_probe_started(instance_key: instance_key(instance_id), publisher_token: publisher_token) end |
#readiness_succeeded(instance_id:, probe_token:) ⇒ Object
55 56 57 58 |
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 55 def readiness_succeeded(instance_id:, probe_token:) key = instance_key(instance_id) sync_applied(key, @registry.readiness_succeeded(instance_key: key, probe_token: probe_token)) end |
#remove_instance(instance_id:, publisher_token:) ⇒ Object
65 66 67 68 |
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 65 def remove_instance(instance_id:, publisher_token:) key = instance_key(instance_id) sync_applied(key, @registry.remove_instance(instance_key: key, publisher_token: publisher_token)) end |
#replace_instance_snapshot(instance_id:, publisher_token:, offerings:, sequence:) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 47 def replace_instance_snapshot(instance_id:, publisher_token:, offerings:, sequence:) key = instance_key(instance_id) result = @registry.replace_instance_snapshot( publisher_token: publisher_token, instance_key: key, offerings: offerings, sequence: sequence ) sync_applied(key, result) end |
#snapshot ⇒ Object
70 71 72 |
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 70 def snapshot @registry.snapshot end |