Class: Rafflesia::CacheSweepData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/cache/cache_sweep_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,
  dry_run: :dry_run,
  eligible_size_bytes: :eligible_size_bytes,
  namespace: :namespace,
  namespace_usage: :namespace_usage,
  pinned_size_bytes: :pinned_size_bytes,
  policy: :policy,
  remaining_size_bytes: :remaining_size_bytes,
  removed_count: :removed_count,
  removed_files: :removed_files,
  removed_paths: :removed_paths,
  selected_size_bytes: :selected_size_bytes,
  skipped_pinned_count: :skipped_pinned_count,
  target_dir: :target_dir,
  total_size_bytes: :total_size_bytes
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ CacheSweepData

Returns a new instance of CacheSweepData.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 47

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]
  @dry_run = hash[:dry_run]
  @eligible_size_bytes = hash[:eligible_size_bytes]
  @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
  @remaining_size_bytes = hash[:remaining_size_bytes]
  @removed_count = hash[:removed_count]
  @removed_files = (hash[:removed_files] || []).map { |item| item ? Rafflesia::CacheEvictedFile.new(item) : nil }
  @removed_paths = (hash[:removed_paths] || [])
  @selected_size_bytes = hash[:selected_size_bytes]
  @skipped_pinned_count = hash[:skipped_pinned_count]
  @target_dir = hash[:target_dir]
  @total_size_bytes = hash[:total_size_bytes]
end

Instance Attribute Details

#active_lease_countObject

Returns the value of attribute active_lease_count.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def active_lease_count
  @active_lease_count
end

#active_lease_pinned_countObject

Returns the value of attribute active_lease_pinned_count.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def active_lease_pinned_count
  @active_lease_pinned_count
end

#age_basisObject

Returns the value of attribute age_basis.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def age_basis
  @age_basis
end

#dry_runObject

Returns the value of attribute dry_run.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def dry_run
  @dry_run
end

#eligible_size_bytesObject

Returns the value of attribute eligible_size_bytes.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def eligible_size_bytes
  @eligible_size_bytes
end

#namespaceObject

Returns the value of attribute namespace.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def namespace
  @namespace
end

#namespace_usageObject

Returns the value of attribute namespace_usage.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def namespace_usage
  @namespace_usage
end

#pinned_size_bytesObject

Returns the value of attribute pinned_size_bytes.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def pinned_size_bytes
  @pinned_size_bytes
end

#policyObject

Returns the value of attribute policy.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def policy
  @policy
end

#remaining_size_bytesObject

Returns the value of attribute remaining_size_bytes.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def remaining_size_bytes
  @remaining_size_bytes
end

#removed_countObject

Returns the value of attribute removed_count.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def removed_count
  @removed_count
end

#removed_filesObject

Returns the value of attribute removed_files.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def removed_files
  @removed_files
end

#removed_pathsObject

Returns the value of attribute removed_paths.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def removed_paths
  @removed_paths
end

#selected_size_bytesObject

Returns the value of attribute selected_size_bytes.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def selected_size_bytes
  @selected_size_bytes
end

#skipped_pinned_countObject

Returns the value of attribute skipped_pinned_count.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def skipped_pinned_count
  @skipped_pinned_count
end

#target_dirObject

Returns the value of attribute target_dir.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def target_dir
  @target_dir
end

#total_size_bytesObject

Returns the value of attribute total_size_bytes.



28
29
30
# File 'lib/rafflesia/cache/cache_sweep_data.rb', line 28

def total_size_bytes
  @total_size_bytes
end