utils

package
v0.152.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors.

SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors.

SPDX-License-Identifier: Apache-2.0

SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors.

SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	// ManifestFile is the name of the manifest file of a serialized oci artifact
	ManifestFile = "manifest.json"

	// IndexFile is the name of the image index file of a serialized oci artifact
	IndexFile = "index.json"

	// BlobsDir is the name of the blobs directory of a serialized oci artifact
	BlobsDir = "blobs"
)
View Source
const (
	// ComponentDescriptorFile is the filename of the component descriptor in a processor message tar archive
	ComponentDescriptorFile = "component-descriptor.yaml"

	// ResourceFile is the filename of the resource in a processor message tar archive
	ResourceFile = "resource.yaml"

	// ResourceBlobFile is the filename of the resource blob in a processor message tar archive
	ResourceBlobFile = "resource-blob"
)

Variables

This section is empty.

Functions

func DeserializeOCIArtifact

func DeserializeOCIArtifact(reader io.Reader, cache cache.Cache) (*oci.Artifact, error)

DeserializeOCIArtifact deserializes an oci artifact from a TAR archive. the TAR archive must contain a manifest.json (if the oci artifact is of type manifest) or index.json (if the oci artifact artifact is a docker image list / oci image index) and a single directory which contains all blobs. all blobs from the blobs directory are stored in the cache instance during deserialization.

func ReadProcessorMessage

func ReadProcessorMessage(r io.Reader) (*cdv2.ComponentDescriptor, cdv2.Resource, io.ReadSeekCloser, error)

ReadProcessorMessage reads the component descriptor, resource and resource blob from a processor message (tar archive with fixed filenames for component descriptor, resource, and resource blob) which is produced by processors. The resource blob reader can be nil. If a non-nil value is returned, it must be closed by the caller.

func SerializeOCIArtifact

func SerializeOCIArtifact(ociArtifact oci.Artifact, cache cache.Cache) (io.ReadCloser, error)

SerializeOCIArtifact serializes an oci artifact into a TAR archive. the TAR archive contains the manifest.json (if the oci artifact is of type manifest) or index.json (if the oci artifact is a docker image list / oci image index) and a single directory which contains all blobs. The cache instance is used for reading config and layer blobs. returns a reader for the TAR archive which *MUST* be closed by the caller.

func WriteProcessorMessage

func WriteProcessorMessage(cd cdv2.ComponentDescriptor, res cdv2.Resource, resourceBlobReader io.Reader, w io.Writer) error

WriteProcessorMessage writes a component descriptor, resource and resource blob as a processor message (tar archive with fixed filenames for component descriptor, resource, and resource blob) which can be consumed by processors.

Types

type HandlerFunc

type HandlerFunc func(io.Reader, io.WriteCloser)

HandlerFunc defines the interface of a function that should be served by a Unix Domain Socket server

type UnixDomainSocketServer

type UnixDomainSocketServer struct {
	// contains filtered or unexported fields
}

UnixDomainSocketServer implements a Unix Domain Socket server

func NewUnixDomainSocketServer

func NewUnixDomainSocketServer(addr string, handler HandlerFunc) (*UnixDomainSocketServer, error)

NewUnixDomainSocketServer returns a new Unix Domain Socket server. The parameters define the server address and the handler func it serves

func (*UnixDomainSocketServer) Start

func (s *UnixDomainSocketServer) Start()

Start starts the server goroutine

func (*UnixDomainSocketServer) Stop

func (s *UnixDomainSocketServer) Stop()

Stop stops the server goroutine

Jump to

Keyboard shortcuts

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