Class: Legion::Extensions::Llm::Inventory::ProbeRequest
- Inherits:
-
Data
- Object
- Data
- Legion::Extensions::Llm::Inventory::ProbeRequest
- Defined in:
- lib/legion/extensions/llm/inventory/probe_token.rb
Overview
A process-local enqueue value asking the owning provider actor to run its safe readiness operation. Grants no registry mutation authority and carries no authorization secret. See section 11.2.
Instance Attribute Summary collapse
-
#instance_key ⇒ Object
readonly
Returns the value of attribute instance_key.
-
#publisher_token_id ⇒ Object
readonly
Returns the value of attribute publisher_token_id.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#unavailable_revision ⇒ Object
readonly
Returns the value of attribute unavailable_revision.
Instance Method Summary collapse
-
#initialize(instance_key:, publisher_token_id:, unavailable_revision:, reason:) ⇒ ProbeRequest
constructor
A new instance of ProbeRequest.
- #sanitized_reason(reason) ⇒ Object
Constructor Details
#initialize(instance_key:, publisher_token_id:, unavailable_revision:, reason:) ⇒ ProbeRequest
Returns a new instance of ProbeRequest.
116 117 118 119 120 121 122 123 124 125 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 116 def initialize(instance_key:, publisher_token_id:, unavailable_revision:, reason:) raise Errors::ValidationError, 'instance_key must be an InstanceKey' unless instance_key.is_a?(Identity::InstanceKey) raise Errors::ValidationError, 'publisher_token_id must be a nonempty ptok:v1: String' unless publisher_token_id.is_a?(::String) && publisher_token_id.start_with?('ptok:v1:') raise Errors::ValidationError, 'unavailable_revision must be a positive Integer' unless unavailable_revision.is_a?(::Integer) && unavailable_revision.positive? super( instance_key: instance_key, publisher_token_id: publisher_token_id.dup.freeze, unavailable_revision: unavailable_revision, reason: sanitized_reason(reason) ) end |
Instance Attribute Details
#instance_key ⇒ Object (readonly)
Returns the value of attribute instance_key
115 116 117 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 115 def instance_key @instance_key end |
#publisher_token_id ⇒ Object (readonly)
Returns the value of attribute publisher_token_id
115 116 117 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 115 def publisher_token_id @publisher_token_id end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason
115 116 117 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 115 def reason @reason end |
#unavailable_revision ⇒ Object (readonly)
Returns the value of attribute unavailable_revision
115 116 117 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 115 def unavailable_revision @unavailable_revision end |
Instance Method Details
#sanitized_reason(reason) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 127 def sanitized_reason(reason) unless reason.is_a?(::String) && [::Encoding::UTF_8, ::Encoding::US_ASCII].include?(reason.encoding) && reason.valid_encoding? raise Errors::ValidationError, 'reason must be a valid UTF-8 String' end trimmed = reason.strip raise Errors::ValidationError, 'reason must not be empty' if trimmed.empty? raise Errors::ValidationError, 'reason exceeds 1024 UTF-8 bytes' if trimmed.bytesize > 1024 trimmed.b.dup.force_encoding(::Encoding::UTF_8).freeze end |