summaryrefslogtreecommitdiff
path: root/app/models/ci/artifact_blob.rb
blob: b35febc9ac5a589f9f5aaed2608a29db6ebf4239 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module Ci
  class ArtifactBlob
    include BlobLike

    attr_reader :entry

    def initialize(entry)
      @entry = entry
    end

    delegate :name, :path, to: :entry

    def id
      Digest::SHA1.hexdigest(path)
    end

    def size
      entry.metadata[:size]
    end

    def data
      "Build artifact #{path}"
    end

    def mode
      entry.metadata[:mode]
    end

    def external_storage
      :build_artifact
    end

    alias_method :external_size, :size
  end
end