Documentation ¶
Index ¶
Constants ¶
const ( // ManifestSchemaVersion is the current manifest schema version. ManifestSchemaVersion = 1 // ManifestDigestAlgo is the only supported digest's algorithm by current manifest schema version. ManifestDigestAlgo = digest.SHA256 )
Variables ¶
This section is empty.
Functions ¶
func WriteManifest ¶
WriteManifest writes manifest's data to a file named by filename.
Types ¶
type Descriptor ¶
type Descriptor struct { // Digest is the digest of the targeted content. Digest digest.Digest `json:"digest"` // Size specifies the size in bytes of the targeted content. Size uint64 `json:"size"` // Paths specifies the relative locations of the targeted content. Paths []string `json:"paths"` }
Descriptor describes the disposition of targeted content.
func NewDescriptor ¶
func NewDescriptor(path string, src io.Reader) (*Descriptor, error)
NewDescriptor returns a new *Descriptor for the provided path and src.
type Manifest ¶
type Manifest struct { // SchemaVersion is the manifest schema that this bundle follows SchemaVersion uint `json:"schemaVersion"` // Items is an ordered list of items referenced by the manifest. Items []Descriptor `json:"items"` }
Manifest provides bundle structure when marshalled to JSON.
Specifications (version 1):
- `schemaVersion` is the version number of the current specification (MUST be always 1 in this case)
- fields order is defined as per code structs definitions, orderning MUST NOT be changed
- `items` MUST be sorted by digest's value (lexically byte-wise)
- multiple `items` MUST NOT have the same digest value
- `items.paths` MUST be sorted by value (lexically byte-wise)
- across the same manifest multiple `items.paths`'s elements MUST NOT have the same value
- json representation of the manifest MUST NOT be indented
- sha256 is the only digest's algorithm that MUST be used
The Normalize() method provides sorting funcionality and specification enforcement. It's implictly called when the manifest is marshalled.
func NewManifest ¶
func NewManifest(items ...Descriptor) *Manifest
NewManifest returns a new empty Manifest.
func ReadManifest ¶
ReadManifest reads the file named by filename and returns the decoded manifest.
func (Manifest) Diff ¶
Diff returns a human-readable report as string of the raw differences between m and x.
Do not depend on this output being stable.
func (Manifest) DiffByPath ¶
DiffByPath returns a human-readable report as string containing additions, modifications, renamings, deletions of x.Items relative to m.Items listed by path.
Do not depend on this output being stable.
func (*Manifest) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.