Class: Rafflesia::CacheAdmissionData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/cache/cache_admission_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  admit: :admit,
  candidate_object_ids: :candidate_object_ids,
  candidate_ref: :candidate_ref,
  current_size_bytes: :current_size_bytes,
  eligible_size_bytes: :eligible_size_bytes,
  estimated_size_bytes: :estimated_size_bytes,
  eviction_plan: :eviction_plan,
  max_bytes: :max_bytes,
  namespace: :namespace,
  pinned_size_bytes: :pinned_size_bytes,
  planned_eviction_bytes: :planned_eviction_bytes,
  planned_eviction_count: :planned_eviction_count,
  policy: :policy,
  projected_size_bytes: :projected_size_bytes,
  reasons: :reasons,
  required_eviction_bytes: :required_eviction_bytes,
  requires_eviction: :requires_eviction,
  schema_version: :schema_version,
  status: :status,
  target_dir: :target_dir,
  workload: :workload,
  workload_profile: :workload_profile
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ CacheAdmissionData

Returns a new instance of CacheAdmissionData.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 57

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @admit = hash[:admit]
  @candidate_object_ids = (hash[:candidate_object_ids] || [])
  @candidate_ref = hash[:candidate_ref]
  @current_size_bytes = hash[:current_size_bytes]
  @eligible_size_bytes = hash[:eligible_size_bytes]
  @estimated_size_bytes = hash[:estimated_size_bytes]
  @eviction_plan = hash[:eviction_plan] ? Rafflesia::CacheSweepData.new(hash[:eviction_plan]) : nil
  @max_bytes = hash[:max_bytes]
  @namespace = hash[:namespace]
  @pinned_size_bytes = hash[:pinned_size_bytes]
  @planned_eviction_bytes = hash[:planned_eviction_bytes]
  @planned_eviction_count = hash[:planned_eviction_count]
  @policy = hash[:policy] ? Rafflesia::CacheEvictionPolicy.new(hash[:policy]) : nil
  @projected_size_bytes = hash[:projected_size_bytes]
  @reasons = (hash[:reasons] || [])
  @required_eviction_bytes = hash[:required_eviction_bytes]
  @requires_eviction = hash[:requires_eviction]
  @schema_version = hash[:schema_version]
  @status = hash[:status]
  @target_dir = hash[:target_dir]
  @workload = hash[:workload]
  @workload_profile = hash[:workload_profile] ? Rafflesia::ServerlessWorkloadProfile.new(hash[:workload_profile]) : nil
end

Instance Attribute Details

#admitObject

Returns the value of attribute admit.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def admit
  @admit
end

#candidate_object_idsObject

Returns the value of attribute candidate_object_ids.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def candidate_object_ids
  @candidate_object_ids
end

#candidate_refObject

Returns the value of attribute candidate_ref.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def candidate_ref
  @candidate_ref
end

#current_size_bytesObject

Returns the value of attribute current_size_bytes.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def current_size_bytes
  @current_size_bytes
end

#eligible_size_bytesObject

Returns the value of attribute eligible_size_bytes.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def eligible_size_bytes
  @eligible_size_bytes
end

#estimated_size_bytesObject

Returns the value of attribute estimated_size_bytes.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def estimated_size_bytes
  @estimated_size_bytes
end

#eviction_planObject

Returns the value of attribute eviction_plan.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def eviction_plan
  @eviction_plan
end

#max_bytesObject

Returns the value of attribute max_bytes.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def max_bytes
  @max_bytes
end

#namespaceObject

Returns the value of attribute namespace.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def namespace
  @namespace
end

#pinned_size_bytesObject

Returns the value of attribute pinned_size_bytes.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def pinned_size_bytes
  @pinned_size_bytes
end

#planned_eviction_bytesObject

Returns the value of attribute planned_eviction_bytes.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def planned_eviction_bytes
  @planned_eviction_bytes
end

#planned_eviction_countObject

Returns the value of attribute planned_eviction_count.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def planned_eviction_count
  @planned_eviction_count
end

#policyObject

Returns the value of attribute policy.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def policy
  @policy
end

#projected_size_bytesObject

Returns the value of attribute projected_size_bytes.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def projected_size_bytes
  @projected_size_bytes
end

#reasonsObject

Returns the value of attribute reasons.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def reasons
  @reasons
end

#required_eviction_bytesObject

Returns the value of attribute required_eviction_bytes.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def required_eviction_bytes
  @required_eviction_bytes
end

#requires_evictionObject

Returns the value of attribute requires_eviction.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def requires_eviction
  @requires_eviction
end

#schema_versionObject

Returns the value of attribute schema_version.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def schema_version
  @schema_version
end

#statusObject

Returns the value of attribute status.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def status
  @status
end

#target_dirObject

Returns the value of attribute target_dir.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def target_dir
  @target_dir
end

#workloadObject

Returns the value of attribute workload.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def workload
  @workload
end

#workload_profileObject

Returns the value of attribute workload_profile.



33
34
35
# File 'lib/rafflesia/cache/cache_admission_data.rb', line 33

def workload_profile
  @workload_profile
end