Class: Rafflesia::CacheStatusData

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

Constant Summary collapse

HASH_ATTRS =
{
  active_lease_count: :active_lease_count,
  active_lease_pinned_count: :active_lease_pinned_count,
  age_basis: :age_basis,
  eligible_size_bytes: :eligible_size_bytes,
  eviction_candidate_count: :eviction_candidate_count,
  eviction_candidate_size_bytes: :eviction_candidate_size_bytes,
  file_count: :file_count,
  files: :files,
  namespace: :namespace,
  namespace_usage: :namespace_usage,
  pinned_size_bytes: :pinned_size_bytes,
  policy: :policy,
  reasons: :reasons,
  remaining_size_bytes: :remaining_size_bytes,
  schema_version: :schema_version,
  status: :status,
  storage_backend: :storage_backend,
  store_root: :store_root,
  target_dir: :target_dir,
  total_size_bytes: :total_size_bytes,
  workload_profile: :workload_profile
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ CacheStatusData

Returns a new instance of CacheStatusData.



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

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @active_lease_count = hash[:active_lease_count]
  @active_lease_pinned_count = hash[:active_lease_pinned_count]
  @age_basis = hash[:age_basis]
  @eligible_size_bytes = hash[:eligible_size_bytes]
  @eviction_candidate_count = hash[:eviction_candidate_count]
  @eviction_candidate_size_bytes = hash[:eviction_candidate_size_bytes]
  @file_count = hash[:file_count]
  @files = (hash[:files] || []).map { |item| item ? Rafflesia::CacheStatusFile.new(item) : nil }
  @namespace = hash[:namespace]
  @namespace_usage = (hash[:namespace_usage] || []).map { |item| item ? Rafflesia::CacheNamespaceUsage.new(item) : nil }
  @pinned_size_bytes = hash[:pinned_size_bytes]
  @policy = hash[:policy] ? Rafflesia::CacheEvictionPolicy.new(hash[:policy]) : nil
  @reasons = (hash[:reasons] || [])
  @remaining_size_bytes = hash[:remaining_size_bytes]
  @schema_version = hash[:schema_version]
  @status = hash[:status]
  @storage_backend = hash[:storage_backend]
  @store_root = hash[:store_root]
  @target_dir = hash[:target_dir]
  @total_size_bytes = hash[:total_size_bytes]
  @workload_profile = hash[:workload_profile] ? Rafflesia::ServerlessWorkloadProfile.new(hash[:workload_profile]) : nil
end

Instance Attribute Details

#active_lease_countObject

Returns the value of attribute active_lease_count.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def active_lease_count
  @active_lease_count
end

#active_lease_pinned_countObject

Returns the value of attribute active_lease_pinned_count.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def active_lease_pinned_count
  @active_lease_pinned_count
end

#age_basisObject

Returns the value of attribute age_basis.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def age_basis
  @age_basis
end

#eligible_size_bytesObject

Returns the value of attribute eligible_size_bytes.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def eligible_size_bytes
  @eligible_size_bytes
end

#eviction_candidate_countObject

Returns the value of attribute eviction_candidate_count.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def eviction_candidate_count
  @eviction_candidate_count
end

#eviction_candidate_size_bytesObject

Returns the value of attribute eviction_candidate_size_bytes.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def eviction_candidate_size_bytes
  @eviction_candidate_size_bytes
end

#file_countObject

Returns the value of attribute file_count.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def file_count
  @file_count
end

#filesObject

Returns the value of attribute files.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def files
  @files
end

#namespaceObject

Returns the value of attribute namespace.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def namespace
  @namespace
end

#namespace_usageObject

Returns the value of attribute namespace_usage.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def namespace_usage
  @namespace_usage
end

#pinned_size_bytesObject

Returns the value of attribute pinned_size_bytes.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def pinned_size_bytes
  @pinned_size_bytes
end

#policyObject

Returns the value of attribute policy.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def policy
  @policy
end

#reasonsObject

Returns the value of attribute reasons.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def reasons
  @reasons
end

#remaining_size_bytesObject

Returns the value of attribute remaining_size_bytes.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def remaining_size_bytes
  @remaining_size_bytes
end

#schema_versionObject

Returns the value of attribute schema_version.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def schema_version
  @schema_version
end

#statusObject

Returns the value of attribute status.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def status
  @status
end

#storage_backendObject

Returns the value of attribute storage_backend.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def storage_backend
  @storage_backend
end

#store_rootObject

Returns the value of attribute store_root.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def store_root
  @store_root
end

#target_dirObject

Returns the value of attribute target_dir.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def target_dir
  @target_dir
end

#total_size_bytesObject

Returns the value of attribute total_size_bytes.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def total_size_bytes
  @total_size_bytes
end

#workload_profileObject

Returns the value of attribute workload_profile.



32
33
34
# File 'lib/rafflesia/cache/cache_status_data.rb', line 32

def workload_profile
  @workload_profile
end