Class: Textus::Protocol::Manifest::Data
- Inherits:
-
Object
- Object
- Textus::Protocol::Manifest::Data
- Defined in:
- lib/textus/protocol/manifest/data.rb
Constant Summary collapse
- AUDIT_DEFAULTS =
{ max_size: 10_485_760, keep: 1000 }.freeze
- WORKER_DEFAULTS =
{ pool: 4, poll: 5, lease_ttl: 60, max_attempts: 3 }.freeze
Instance Attribute Summary collapse
-
#audit_config ⇒ Object
readonly
Returns the value of attribute audit_config.
-
#declared_lane_kinds ⇒ Object
readonly
Returns the value of attribute declared_lane_kinds.
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
-
#lane_descs ⇒ Object
readonly
Returns the value of attribute lane_descs.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#role_caps ⇒ Object
readonly
Returns the value of attribute role_caps.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#worker_config ⇒ Object
readonly
Returns the value of attribute worker_config.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw:, root:) ⇒ Data
constructor
A new instance of Data.
- #validate_key!(key) ⇒ Object
Constructor Details
#initialize(raw:, root:) ⇒ Data
Returns a new instance of Data.
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/textus/protocol/manifest/data.rb', line 37 def initialize(raw:, root:) @raw = raw @root = root @declared_lane_kinds = Textus::Protocol::V4::LANES.keys.to_h { |name| [name, name] } @lane_descs = Textus::Protocol::V4::LANES.transform_values { |row| row[:desc] } @audit_config = build_audit_config(raw) @worker_config = build_worker_config(raw) @role_caps = {} @entries = build_entries(raw) validate_declared_keys! freeze end |
Instance Attribute Details
#audit_config ⇒ Object (readonly)
Returns the value of attribute audit_config.
10 11 12 |
# File 'lib/textus/protocol/manifest/data.rb', line 10 def audit_config @audit_config end |
#declared_lane_kinds ⇒ Object (readonly)
Returns the value of attribute declared_lane_kinds.
10 11 12 |
# File 'lib/textus/protocol/manifest/data.rb', line 10 def declared_lane_kinds @declared_lane_kinds end |
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
10 11 12 |
# File 'lib/textus/protocol/manifest/data.rb', line 10 def entries @entries end |
#lane_descs ⇒ Object (readonly)
Returns the value of attribute lane_descs.
10 11 12 |
# File 'lib/textus/protocol/manifest/data.rb', line 10 def lane_descs @lane_descs end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
10 11 12 |
# File 'lib/textus/protocol/manifest/data.rb', line 10 def raw @raw end |
#role_caps ⇒ Object (readonly)
Returns the value of attribute role_caps.
10 11 12 |
# File 'lib/textus/protocol/manifest/data.rb', line 10 def role_caps @role_caps end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
10 11 12 |
# File 'lib/textus/protocol/manifest/data.rb', line 10 def root @root end |
#worker_config ⇒ Object (readonly)
Returns the value of attribute worker_config.
10 11 12 |
# File 'lib/textus/protocol/manifest/data.rb', line 10 def worker_config @worker_config end |
Class Method Details
.parse(raw, root:) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/textus/protocol/manifest/data.rb', line 22 def self.parse(raw, root:) %w[roles lanes owner].each do |stale_key| next unless raw.key?(stale_key) raise BadManifest.new( "unknown top-level key '#{stale_key}' — protocol textus/4 fixes roles/lanes in " \ "code; remove this section from manifest.yaml (see CHANGELOG)", ) end raise BadManifest.new("manifest must declare data:") if Array(raw["data"]).empty? && raw["data"] != {} Schema.validate!(raw) new(raw: raw, root: root) end |
Instance Method Details
#validate_key!(key) ⇒ Object
20 |
# File 'lib/textus/protocol/manifest/data.rb', line 20 def validate_key!(key) = self.class.validate_key!(key) |