Class: Gitlab::ImportExport::DecompressedArchiveSizeValidator
- Inherits:
-
Object
- Object
- Gitlab::ImportExport::DecompressedArchiveSizeValidator
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/import_export/decompressed_archive_size_validator.rb
Constant Summary collapse
- DEFAULT_MAX_BYTES =
10.gigabytes.freeze
- CHUNK_SIZE =
4096.freeze
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Class Method Summary collapse
Instance Method Summary collapse
- #archive_file ⇒ Object
-
#initialize(archive_path:, max_bytes: self.class.max_bytes) ⇒ DecompressedArchiveSizeValidator
constructor
A new instance of DecompressedArchiveSizeValidator.
- #valid? ⇒ Boolean
Methods included from Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Constructor Details
#initialize(archive_path:, max_bytes: self.class.max_bytes) ⇒ DecompressedArchiveSizeValidator
Returns a new instance of DecompressedArchiveSizeValidator.
15 16 17 18 19 20 21 22 |
# File 'lib/gitlab/import_export/decompressed_archive_size_validator.rb', line 15 def initialize(archive_path:, max_bytes: self.class.max_bytes) @archive_path = archive_path @max_bytes = max_bytes @bytes_read = 0 @total_reads = 0 @denominator = 5 @error = nil end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error
13 14 15 |
# File 'lib/gitlab/import_export/decompressed_archive_size_validator.rb', line 13 def error @error end |
Class Method Details
.max_bytes ⇒ Object
30 31 32 |
# File 'lib/gitlab/import_export/decompressed_archive_size_validator.rb', line 30 def self.max_bytes DEFAULT_MAX_BYTES end |
Instance Method Details
#archive_file ⇒ Object
34 35 36 |
# File 'lib/gitlab/import_export/decompressed_archive_size_validator.rb', line 34 def archive_file @archive_file ||= File.open(@archive_path) end |
#valid? ⇒ Boolean
24 25 26 27 28 |
# File 'lib/gitlab/import_export/decompressed_archive_size_validator.rb', line 24 def valid? strong_memoize(:valid) do validate end end |