artifact

package
v0.50.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArchiveManifestSchema = "urn:ivcap:schema:artifact.archive-manifest.1"
	ROCrateContext        = "https://w3id.org/ro/crate/1.2/context"
	ROCrateProfile        = "https://w3id.org/ro/crate/1.2"

	// LicenseUndefined is the default of --license: the license of the content is not known.
	LicenseUndefined = "undefined"
)

Variables

This section is empty.

Functions

func AddArtifactMeta

func AddArtifactMeta(
	ctxt context.Context,
	artifactID string,
	schemaName string,
	meta io.Reader,
	size int64,
	adpt *adapter.Adapter,
	logger *log.Logger,
) (adapter.Payload, error)

func AddArtifactToCollection

func AddArtifactToCollection(
	ctxt context.Context,
	artifactID string,
	collectionName string,
	adpt *adapter.Adapter,
	logger *log.Logger,
) (adapter.Payload, error)

func CreateArtifact

func CreateArtifact(
	ctxt context.Context,
	cmd *CreateArtifactRequest,
	contentType string,
	size int64,
	reader io.Reader,
	adpt *adapter.Adapter,
	logger *log.Logger,
) (*api.UploadResponseBody, error)

func CreateArtifactRaw

func CreateArtifactRaw(
	ctxt context.Context,
	cmd *CreateArtifactRequest,
	contentType string,
	size int64,
	reader io.Reader,
	adpt *adapter.Adapter,
	logger *log.Logger,
) (adapter.Payload, error)

func ForFile

func ForFile(fileName, schema string, metadata Metadata) ([]byte, error)

func IsArchive

func IsArchive(fileName string) bool

IsArchive reports whether the file gets a manifest: a regular file whose name ends in .zip, .tar, .tar.gz or .tgz. Only the name decides. The content is deliberately not sniffed, so ZIP-based formats such as .docx or .jar are not indexed and pipes are never read.

func ListArtifacts

func ListArtifacts(ctxt context.Context, cmd *sdk.ListRequest, adpt *adapter.Adapter, logger *log.Logger) (*api.ListResponseBody, error)

func ListArtifactsRaw

func ListArtifactsRaw(ctxt context.Context, cmd *sdk.ListRequest, adpt *adapter.Adapter, logger *log.Logger) (adapter.Payload, error)

func ReadArtifact

func ReadArtifact(ctxt context.Context, cmd *ReadArtifactRequest, adpt *adapter.Adapter, logger *log.Logger) (*api.ReadResponseBody, error)

func ReadArtifactRaw

func ReadArtifactRaw(ctxt context.Context, cmd *ReadArtifactRequest, adpt *adapter.Adapter, logger *log.Logger) (adapter.Payload, error)

func RemoveArtifactToCollection

func RemoveArtifactToCollection(
	ctxt context.Context,
	artifactID string,
	collectionName string,
	adpt *adapter.Adapter,
	logger *log.Logger,
) (adapter.Payload, error)

func UploadArtifact

func UploadArtifact(
	ctxt context.Context,
	reader io.Reader,
	size int64,
	offset int64,
	chunkSize int64,
	path string,
	adpt *adapter.Adapter,
	silent bool,
	logger *log.Logger,
) (err error)

Types

type Aspect

type Aspect struct {
	Schema  string   `json:"$schema"`
	Profile string   `json:"profile"`
	ROCrate Document `json:"ro_crate"`
}

type CreateArtifactRequest

type CreateArtifactRequest struct {
	Name       string            `json:"name"`
	Size       int64             `json:"size"`
	Collection string            `json:"collection"`
	Policy     string            `json:"policy"`
	Meta       map[string]string `json:"meta"`
}

type Document

type Document struct {
	Context string   `json:"@context"`
	Graph   []Entity `json:"@graph"`
}

func Build

func Build(metadata Metadata, entries []Entry) Document

type Entity

type Entity struct {
	ID             string `json:"@id"`
	Type           string `json:"@type"`
	About          *Ref   `json:"about,omitempty"`
	ConformsTo     *Ref   `json:"conformsTo,omitempty"`
	Name           string `json:"name,omitempty"`
	Description    string `json:"description,omitempty"`
	Identifier     string `json:"identifier,omitempty"`
	HasPart        []Ref  `json:"hasPart,omitempty"`
	License        *Ref   `json:"license,omitempty"`
	DatePublished  string `json:"datePublished,omitempty"`
	ContentSize    string `json:"contentSize,omitempty"`
	EncodingFormat string `json:"encodingFormat,omitempty"`
}

type Entry

type Entry struct {
	Name string
	Size uint64
}

type License

type License struct {
	ID          string
	Name        string
	Description string
}

License is the contextual entity the root dataset of a manifest points at.

func ResolveLicense

func ResolveLicense(value string) (License, error)

ResolveLicense turns a --license value into the license entity of the manifest. The value is 'undefined' (or empty), an absolute http(s) URL, or an SPDX license identifier. Identifiers are not checked against the SPDX list, so a misspelt one yields a link that does not resolve.

type Metadata

type Metadata struct {
	Identifier  string
	Name        string
	Description string
	Published   string
	License     License // zero value: license undefined
}

type ReadArtifactRequest

type ReadArtifactRequest struct {
	Id string
}

type Ref

type Ref struct {
	ID string `json:"@id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL