Class: Legion::Extensions::Llm::Inventory::PublicationStatus

Inherits:
Data
  • Object
show all
Defined in:
lib/legion/extensions/llm/inventory/records.rb

Overview

Publication-scope status distinguishing an initializing claim from an authoritative complete catalog. See section 10.7.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ PublicationStatus

Returns a new instance of PublicationStatus.



524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/legion/extensions/llm/inventory/records.rb', line 524

def initialize(**kwargs)
  kwargs = {
    last_probe_started_at: nil, last_probe_completed_at: nil, last_probe_outcome: nil, last_error: nil
  }.merge(kwargs)
  RecordSupport.check_unknown_kwargs!(kwargs: kwargs, members: self.class.members)

  instance_key = kwargs[:instance_key]
  published_sequence = kwargs[:published_sequence]
  last_probe_outcome = kwargs[:last_probe_outcome]
  raise Errors::ValidationError, 'instance_key must be an InstanceKey' unless instance_key.is_a?(Identity::InstanceKey)
  raise Errors::ValidationError, 'state must be :initializing or :complete' unless Taxonomies::PUBLICATION_STATES.include?(kwargs[:state])
  raise Errors::ValidationError, 'published_sequence must be nil or a nonnegative Integer' unless published_sequence.nil? || RecordSupport.nonnegative_integer?(published_sequence)
  raise Errors::ValidationError, 'last_probe_outcome must be nil, :success, or :failure' unless last_probe_outcome.nil? || Taxonomies::PROBE_OUTCOMES.include?(last_probe_outcome)

  super(
    instance_key: instance_key,
    state: kwargs[:state],
    publisher_token_id: kwargs[:publisher_token_id].nil? ? nil : kwargs[:publisher_token_id].dup.freeze,
    published_sequence: published_sequence,
    last_probe_started_at: RecordSupport.optional_time(value: kwargs[:last_probe_started_at], field: :last_probe_started_at),
    last_probe_completed_at: RecordSupport.optional_time(value: kwargs[:last_probe_completed_at], field: :last_probe_completed_at),
    last_probe_outcome: last_probe_outcome,
    last_error: RecordSupport.optional_sanitized_reason(value: kwargs[:last_error], field: :last_error)
  )
end

Instance Attribute Details

#instance_keyObject (readonly)

Returns the value of attribute instance_key

Returns:

  • (Object)

    the current value of instance_key



520
521
522
# File 'lib/legion/extensions/llm/inventory/records.rb', line 520

def instance_key
  @instance_key
end

#last_errorObject (readonly)

Returns the value of attribute last_error

Returns:

  • (Object)

    the current value of last_error



520
521
522
# File 'lib/legion/extensions/llm/inventory/records.rb', line 520

def last_error
  @last_error
end

#last_probe_completed_atObject (readonly)

Returns the value of attribute last_probe_completed_at

Returns:

  • (Object)

    the current value of last_probe_completed_at



520
521
522
# File 'lib/legion/extensions/llm/inventory/records.rb', line 520

def last_probe_completed_at
  @last_probe_completed_at
end

#last_probe_outcomeObject (readonly)

Returns the value of attribute last_probe_outcome

Returns:

  • (Object)

    the current value of last_probe_outcome



520
521
522
# File 'lib/legion/extensions/llm/inventory/records.rb', line 520

def last_probe_outcome
  @last_probe_outcome
end

#last_probe_started_atObject (readonly)

Returns the value of attribute last_probe_started_at

Returns:

  • (Object)

    the current value of last_probe_started_at



520
521
522
# File 'lib/legion/extensions/llm/inventory/records.rb', line 520

def last_probe_started_at
  @last_probe_started_at
end

#published_sequenceObject (readonly)

Returns the value of attribute published_sequence

Returns:

  • (Object)

    the current value of published_sequence



520
521
522
# File 'lib/legion/extensions/llm/inventory/records.rb', line 520

def published_sequence
  @published_sequence
end

#publisher_token_idObject (readonly)

Returns the value of attribute publisher_token_id

Returns:

  • (Object)

    the current value of publisher_token_id



520
521
522
# File 'lib/legion/extensions/llm/inventory/records.rb', line 520

def publisher_token_id
  @publisher_token_id
end

#stateObject (readonly)

Returns the value of attribute state

Returns:

  • (Object)

    the current value of state



520
521
522
# File 'lib/legion/extensions/llm/inventory/records.rb', line 520

def state
  @state
end