Class: DurableHuggingfaceHub::Types::CachedRepoInfo
- Includes:
- Loadable
- Defined in:
- lib/durable_huggingface_hub/types/cache_info.rb
Overview
Information about a cached repository.
Represents a repository in the cache with all its revisions and files.
Instance Attribute Summary collapse
-
#last_accessed ⇒ Time?
readonly
When the repository was last accessed.
-
#last_modified ⇒ Time?
readonly
When the repository was last modified.
-
#repo_id ⇒ String
readonly
Repository identifier.
-
#repo_type ⇒ String
readonly
Type of repository (“model”, “dataset”, or “space”).
-
#revisions ⇒ Array<CachedRevisionInfo>
readonly
List of cached revisions for this repository.
-
#size ⇒ Integer
readonly
Total size of all revisions in this repository.
Instance Method Summary collapse
-
#file_count ⇒ Integer
Total number of files across all revisions.
-
#revision_count ⇒ Integer
Number of revisions cached for this repository.
-
#size_str ⇒ String
Human-readable size string.
Instance Attribute Details
#last_accessed ⇒ Time? (readonly)
When the repository was last accessed
173 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 173 attribute :last_accessed, Types::OptionalTimestamp.default(nil) |
#last_modified ⇒ Time? (readonly)
When the repository was last modified
178 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 178 attribute :last_modified, Types::OptionalTimestamp.default(nil) |
#repo_id ⇒ String (readonly)
Repository identifier
153 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 153 attribute :repo_id, Types::String |
#repo_type ⇒ String (readonly)
Type of repository (“model”, “dataset”, or “space”)
158 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 158 attribute :repo_type, Types::String |
#revisions ⇒ Array<CachedRevisionInfo> (readonly)
List of cached revisions for this repository
163 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 163 attribute :revisions, Types::Array.of(CachedRevisionInfo) |
#size ⇒ Integer (readonly)
Total size of all revisions in this repository
168 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 168 attribute :size, Types::Integer |
Instance Method Details
#file_count ⇒ Integer
Total number of files across all revisions.
206 207 208 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 206 def file_count revisions.sum(&:file_count) end |
#revision_count ⇒ Integer
Number of revisions cached for this repository.
199 200 201 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 199 def revision_count revisions.length end |
#size_str ⇒ String
Human-readable size string.
183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/durable_huggingface_hub/types/cache_info.rb', line 183 def size_str units = ["B", "KB", "MB", "GB", "TB"] size = self.size.to_f unit_index = 0 while size >= 1024 && unit_index < units.length - 1 size /= 1024.0 unit_index += 1 end format("%.2f %s", size, units[unit_index]) end |