Class: Microsandbox::ImageInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/microsandbox/image.rb

Overview

Metadata for a cached OCI image, from Microsandbox::Image.get / Microsandbox::Image.list.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ImageInfo

Returns a new instance of ImageInfo.



8
9
10
11
12
13
14
15
16
17
# File 'lib/microsandbox/image.rb', line 8

def initialize(data)
  @reference = data["reference"]
  @size_bytes = data["size_bytes"]
  @manifest_digest = data["manifest_digest"]
  @architecture = data["architecture"]
  @os = data["os"]
  @layer_count = data["layer_count"]
  @created_at_ms = data["created_at_ms"]
  @last_used_at_ms = data["last_used_at_ms"]
end

Instance Attribute Details

#architectureObject (readonly)

Returns the value of attribute architecture.



6
7
8
# File 'lib/microsandbox/image.rb', line 6

def architecture
  @architecture
end

#layer_countObject (readonly)

Returns the value of attribute layer_count.



6
7
8
# File 'lib/microsandbox/image.rb', line 6

def layer_count
  @layer_count
end

#manifest_digestObject (readonly)

Returns the value of attribute manifest_digest.



6
7
8
# File 'lib/microsandbox/image.rb', line 6

def manifest_digest
  @manifest_digest
end

#osObject (readonly)

Returns the value of attribute os.



6
7
8
# File 'lib/microsandbox/image.rb', line 6

def os
  @os
end

#referenceObject (readonly)

Returns the value of attribute reference.



6
7
8
# File 'lib/microsandbox/image.rb', line 6

def reference
  @reference
end

#size_bytesObject (readonly)

Returns the value of attribute size_bytes.



6
7
8
# File 'lib/microsandbox/image.rb', line 6

def size_bytes
  @size_bytes
end

Instance Method Details

#created_atTime?

Returns:

  • (Time, nil)


20
21
22
# File 'lib/microsandbox/image.rb', line 20

def created_at
  @created_at_ms && Time.at(@created_at_ms / 1000.0)
end

#inspectObject



29
30
31
# File 'lib/microsandbox/image.rb', line 29

def inspect
  "#<Microsandbox::ImageInfo reference=#{@reference.inspect} layers=#{@layer_count}>"
end

#last_used_atTime?

Returns:

  • (Time, nil)


25
26
27
# File 'lib/microsandbox/image.rb', line 25

def last_used_at
  @last_used_at_ms && Time.at(@last_used_at_ms / 1000.0)
end