Class: Microsandbox::SnapshotInfo
- Inherits:
-
Object
- Object
- Microsandbox::SnapshotInfo
- Defined in:
- lib/microsandbox/snapshot.rb
Overview
Metadata for a snapshot artifact, returned by Microsandbox::Snapshot.create/Microsandbox::Snapshot.get/ Microsandbox::Snapshot.list/Microsandbox::Snapshot.import.
‘digest` and `path` are always present. `create` additionally populates `size_bytes`; `get`/`list`/`import` additionally populate `name`, `parent_digest`, `image_ref`, `format`, and `created_at`.
Instance Attribute Summary collapse
-
#digest ⇒ String
readonly
Manifest digest (“sha256:…”) — the canonical identity.
-
#image_ref ⇒ String?
readonly
Source OCI image reference.
-
#name ⇒ String?
readonly
Name alias (nil for digest-only entries).
-
#parent_digest ⇒ String?
readonly
Parent snapshot digest.
-
#path ⇒ String
readonly
Artifact directory path.
-
#size_bytes ⇒ Integer?
readonly
Artifact size in bytes.
Instance Method Summary collapse
- #created_at ⇒ Time?
-
#format ⇒ Symbol?
Disk format (:raw or :qcow2).
-
#initialize(data) ⇒ SnapshotInfo
constructor
A new instance of SnapshotInfo.
- #inspect ⇒ Object
Constructor Details
#initialize(data) ⇒ SnapshotInfo
Returns a new instance of SnapshotInfo.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/microsandbox/snapshot.rb', line 24 def initialize(data) @digest = data["digest"] @path = data["path"] @name = data["name"] @parent_digest = data["parent_digest"] @image_ref = data["image_ref"] @format = data["format"] @size_bytes = data["size_bytes"] @created_at_ms = data["created_at_ms"] end |
Instance Attribute Details
#digest ⇒ String (readonly)
Returns manifest digest (“sha256:…”) — the canonical identity.
12 13 14 |
# File 'lib/microsandbox/snapshot.rb', line 12 def digest @digest end |
#image_ref ⇒ String? (readonly)
Returns source OCI image reference.
20 21 22 |
# File 'lib/microsandbox/snapshot.rb', line 20 def image_ref @image_ref end |
#name ⇒ String? (readonly)
Returns name alias (nil for digest-only entries).
16 17 18 |
# File 'lib/microsandbox/snapshot.rb', line 16 def name @name end |
#parent_digest ⇒ String? (readonly)
Returns parent snapshot digest.
18 19 20 |
# File 'lib/microsandbox/snapshot.rb', line 18 def parent_digest @parent_digest end |
#path ⇒ String (readonly)
Returns artifact directory path.
14 15 16 |
# File 'lib/microsandbox/snapshot.rb', line 14 def path @path end |
#size_bytes ⇒ Integer? (readonly)
Returns artifact size in bytes.
22 23 24 |
# File 'lib/microsandbox/snapshot.rb', line 22 def size_bytes @size_bytes end |
Instance Method Details
#created_at ⇒ Time?
41 42 43 |
# File 'lib/microsandbox/snapshot.rb', line 41 def created_at @created_at_ms && Time.at(@created_at_ms / 1000.0) end |
#format ⇒ Symbol?
Returns disk format (:raw or :qcow2).
36 37 38 |
# File 'lib/microsandbox/snapshot.rb', line 36 def format @format&.to_sym end |
#inspect ⇒ Object
45 46 47 |
# File 'lib/microsandbox/snapshot.rb', line 45 def inspect "#<Microsandbox::SnapshotInfo digest=#{@digest.inspect}#{@name ? " name=#{@name.inspect}" : ""}>" end |