Class: Legion::Extensions::Llm::Inventory::Publisher

Inherits:
Object
  • Object
show all
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, or provider discovery. M7: the legacy dual-sink seam (compatibility_adapter / old-coordinator projection) is deleted — one representation, one routing authority; the SSOT registry is the only inventory sink.

Instance Method Summary collapse

Constructor Details

#initialize(provider_family:, registry: Registry) ⇒ Publisher

Returns a new instance of Publisher.



19
20
21
22
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 19

def initialize(provider_family:, registry: Registry)
  @provider_family = provider_family
  @registry = registry
end

Instance Method Details

#activate_instance_snapshot(instance_id:, publisher_token:, offerings:, sequence:, probe_token:, physical_id: nil) ⇒ Object

rubocop:disable Metrics/ParameterLists



39
40
41
42
43
44
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 39

def activate_instance_snapshot(instance_id:, publisher_token:, offerings:, sequence:, probe_token:, physical_id: nil) # rubocop:disable Metrics/ParameterLists
  @registry.activate_instance_snapshot(
    publisher_token: publisher_token, instance_key: instance_key(instance_id: instance_id, physical_id: physical_id),
    offerings: offerings, sequence: sequence, probe_token: probe_token
  )
end

#claim_instance(instance_id:, callable:, probe_request_handle:, physical_id: nil) ⇒ Object

Every instance operation takes instance_id: — the operator's CONFIG NAME (the identity the router keys by) — and an optional physical_id: carrying the physical/derived id (host:port/ak) for dedup and diagnostics only. See Identity::InstanceKey.



28
29
30
31
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 28

def claim_instance(instance_id:, callable:, probe_request_handle:, physical_id: nil)
  key = instance_key(instance_id: instance_id, physical_id: physical_id)
  @registry.claim_instance(instance_key: key, callable: callable, probe_request_handle: probe_request_handle)
end

#readiness_failed(instance_id:, probe_token:, reason:, physical_id: nil) ⇒ Object



57
58
59
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 57

def readiness_failed(instance_id:, probe_token:, reason:, physical_id: nil)
  @registry.readiness_failed(instance_key: instance_key(instance_id: instance_id, physical_id: physical_id), probe_token: probe_token, reason: reason)
end

#readiness_probe_started(instance_id:, publisher_token:, physical_id: nil) ⇒ Object



33
34
35
36
37
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 33

def readiness_probe_started(instance_id:, publisher_token:, physical_id: nil)
  @registry.readiness_probe_started(
    instance_key: instance_key(instance_id: instance_id, physical_id: physical_id), publisher_token: publisher_token
  )
end

#readiness_succeeded(instance_id:, probe_token:, physical_id: nil) ⇒ Object



53
54
55
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 53

def readiness_succeeded(instance_id:, probe_token:, physical_id: nil)
  @registry.readiness_succeeded(instance_key: instance_key(instance_id: instance_id, physical_id: physical_id), probe_token: probe_token)
end

#remove_instance(instance_id:, publisher_token:, physical_id: nil) ⇒ Object



61
62
63
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 61

def remove_instance(instance_id:, publisher_token:, physical_id: nil)
  @registry.remove_instance(instance_key: instance_key(instance_id: instance_id, physical_id: physical_id), publisher_token: publisher_token)
end

#replace_instance_snapshot(instance_id:, publisher_token:, offerings:, sequence:, physical_id: nil) ⇒ Object



46
47
48
49
50
51
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 46

def replace_instance_snapshot(instance_id:, publisher_token:, offerings:, sequence:, physical_id: nil)
  @registry.replace_instance_snapshot(
    publisher_token: publisher_token, instance_key: instance_key(instance_id: instance_id, physical_id: physical_id),
    offerings: offerings, sequence: sequence
  )
end

#snapshotObject



65
66
67
# File 'lib/legion/extensions/llm/inventory/publisher.rb', line 65

def snapshot
  @registry.snapshot
end