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.



571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
# File 'lib/legion/extensions/llm/inventory/records.rb', line 571

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



567
568
569
# File 'lib/legion/extensions/llm/inventory/records.rb', line 567

def instance_key
  @instance_key
end

#last_errorObject (readonly)

Returns the value of attribute last_error

Returns:

  • (Object)

    the current value of last_error



567
568
569
# File 'lib/legion/extensions/llm/inventory/records.rb', line 567

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



567
568
569
# File 'lib/legion/extensions/llm/inventory/records.rb', line 567

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



567
568
569
# File 'lib/legion/extensions/llm/inventory/records.rb', line 567

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



567
568
569
# File 'lib/legion/extensions/llm/inventory/records.rb', line 567

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



567
568
569
# File 'lib/legion/extensions/llm/inventory/records.rb', line 567

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



567
568
569
# File 'lib/legion/extensions/llm/inventory/records.rb', line 567

def publisher_token_id
  @publisher_token_id
end

#stateObject (readonly)

Returns the value of attribute state

Returns:

  • (Object)

    the current value of state



567
568
569
# File 'lib/legion/extensions/llm/inventory/records.rb', line 567

def state
  @state
end