/
manifest.go
61 lines (55 loc) · 2.33 KB
/
manifest.go
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*******************************************************************************
*
* Copyright 2024 SAP SE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You should have received a copy of the License along with this
* program. If not, you may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*******************************************************************************/
package models
import (
"time"
"github.com/opencontainers/go-digest"
)
// Manifest contains a record from the `manifests` table.
type Manifest struct {
RepositoryID int64 `db:"repo_id"`
Digest digest.Digest `db:"digest"`
MediaType string `db:"media_type"`
SizeBytes uint64 `db:"size_bytes"`
PushedAt time.Time `db:"pushed_at"`
ValidatedAt time.Time `db:"validated_at"` // see tasks.ManifestValidationJob
ValidationErrorMessage string `db:"validation_error_message"`
LastPulledAt *time.Time `db:"last_pulled_at"`
// LabelsJSON contains a JSON string of a map[string]string, or an empty string.
LabelsJSON string `db:"labels_json"`
// GCStatusJSON contains a keppel.GCStatus serialized into JSON, or an empty
// string if GC has not seen this manifest yet.
GCStatusJSON string `db:"gc_status_json"`
MinLayerCreatedAt *time.Time `db:"min_layer_created_at"`
MaxLayerCreatedAt *time.Time `db:"max_layer_created_at"`
}
// Tag contains a record from the `tags` table.
type Tag struct {
RepositoryID int64 `db:"repo_id"`
Name string `db:"name"`
Digest digest.Digest `db:"digest"`
PushedAt time.Time `db:"pushed_at"`
LastPulledAt *time.Time `db:"last_pulled_at"`
}
// ManifestContent contains a record from the `manifest_contents` table.
type ManifestContent struct {
RepositoryID int64 `db:"repo_id"`
Digest string `db:"digest"`
Content []byte `db:"content"`
}