Documentation ¶
Index ¶
- Variables
- func RegisterProcessor(handler Handler)
- type Applier
- type ApplyConfig
- type ApplyOpt
- type Comparer
- type Config
- type Handler
- type Opt
- type RawProcessor
- type StreamProcessor
- func GetProcessor(ctx context.Context, stream StreamProcessor, payloads map[string]typeurl.Any) (StreamProcessor, error)
- func NewBinaryProcessor(ctx context.Context, imt, rmt string, stream StreamProcessor, name string, ...) (StreamProcessor, error)
- func NewProcessorChain(mt string, r io.Reader) StreamProcessor
- type StreamProcessorInit
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoProcessor is returned when no stream processor is available for a media-type ErrNoProcessor = errors.New("no processor for media-type") )
Functions ¶
func RegisterProcessor ¶ added in v1.3.0
func RegisterProcessor(handler Handler)
RegisterProcessor registers a stream processor for media-types
Types ¶
type Applier ¶ added in v1.1.0
type Applier interface { // Apply applies the content referred to by the given descriptor to // the provided mount. The method of applying is based on the // implementation and content descriptor. For example, in the common // case the descriptor is a file system difference in tar format, // that tar would be applied on top of the mounts. Apply(ctx context.Context, desc ocispec.Descriptor, mount []mount.Mount, opts ...ApplyOpt) (ocispec.Descriptor, error) }
Applier allows applying diffs between mounts
type ApplyConfig ¶ added in v1.3.0
type ApplyConfig struct { // ProcessorPayloads specifies the payload sent to various processors ProcessorPayloads map[string]typeurl.Any // SyncFs is to synchronize the underlying filesystem containing files SyncFs bool }
ApplyConfig is used to hold parameters needed for a apply operation
type ApplyOpt ¶ added in v1.3.0
type ApplyOpt func(context.Context, ocispec.Descriptor, *ApplyConfig) error
ApplyOpt is used to configure an Apply operation
func WithPayloads ¶ added in v1.3.0
WithPayloads sets the apply processor payloads to the config
func WithSyncFs ¶ added in v1.7.14
WithSyncFs sets sync flag to the config.
type Comparer ¶ added in v1.1.0
type Comparer interface { // Compare computes the difference between two mounts and returns a // descriptor for the computed diff. The options can provide // a ref which can be used to track the content creation of the diff. // The media type which is used to determine the format of the created // content can also be provided as an option. Compare(ctx context.Context, lower, upper []mount.Mount, opts ...Opt) (ocispec.Descriptor, error) }
Comparer allows creation of filesystem diffs between mounts
type Config ¶
type Config struct { // MediaType is the type of diff to generate // Default depends on the differ, // i.e. application/vnd.oci.image.layer.v1.tar+gzip MediaType string // Reference is the content upload reference // Default will use a random reference string Reference string // Labels are the labels to apply to the generated content Labels map[string]string // Compressor is a function to compress the diff stream // instead of the default gzip compressor. Differ passes // the MediaType of the target diff content to the compressor. // When using this config, MediaType must be specified as well. Compressor func(dest io.Writer, mediaType string) (io.WriteCloser, error) // SourceDateEpoch specifies the SOURCE_DATE_EPOCH without touching the env vars. SourceDateEpoch *time.Time }
Config is used to hold parameters needed for a diff operation
type Handler ¶ added in v1.3.0
type Handler func(ctx context.Context, mediaType string) (StreamProcessorInit, bool)
Handler checks a media-type and initializes the processor
func BinaryHandler ¶ added in v1.3.0
func BinaryHandler(id, returnsMediaType string, mediaTypes []string, path string, args, env []string) Handler
BinaryHandler creates a new stream processor handler which calls out to the given binary. The id is used to identify the stream processor and allows the caller to send payloads specific for that stream processor (i.e. decryption keys for decrypt stream processor). The binary will be called for the provided mediaTypes and return the given media type.
func StaticHandler ¶ added in v1.3.0
func StaticHandler(expectedMediaType string, fn StreamProcessorInit) Handler
StaticHandler returns the processor init func for a static media-type
type Opt ¶
Opt is used to configure a diff operation
func WithCompressor ¶ added in v1.6.0
WithCompressor sets the function to be used to compress the diff stream.
func WithLabels ¶
WithLabels is used to set content labels on the created diff content.
func WithMediaType ¶
WithMediaType sets the media type to use for creating the diff, without specifying the differ will choose a default.
func WithReference ¶
WithReference is used to set the content upload reference used by the diff operation. This allows the caller to track the upload through the content store.
func WithSourceDateEpoch ¶ added in v1.7.0
WithSourceDateEpoch specifies the timestamp used for whiteouts to provide control for reproducibility. See also https://reproducible-builds.org/docs/source-date-epoch/ .
type RawProcessor ¶ added in v1.3.0
type RawProcessor interface { // File returns the fd for the read stream of the underlying processor File() *os.File }
RawProcessor provides access to direct fd for processing
type StreamProcessor ¶ added in v1.3.0
type StreamProcessor interface { io.ReadCloser // MediaType is the resulting media-type that the processor processes the stream into MediaType() string }
StreamProcessor handles processing a content stream and transforming it into a different media-type
func GetProcessor ¶ added in v1.3.0
func GetProcessor(ctx context.Context, stream StreamProcessor, payloads map[string]typeurl.Any) (StreamProcessor, error)
GetProcessor returns the processor for a media-type
func NewBinaryProcessor ¶ added in v1.3.0
func NewBinaryProcessor(ctx context.Context, imt, rmt string, stream StreamProcessor, name string, args, env []string, payload typeurl.Any) (StreamProcessor, error)
NewBinaryProcessor returns a binary processor for use with processing content streams
func NewProcessorChain ¶ added in v1.3.0
func NewProcessorChain(mt string, r io.Reader) StreamProcessor
NewProcessorChain initialized the root StreamProcessor
type StreamProcessorInit ¶ added in v1.3.0
type StreamProcessorInit func(ctx context.Context, stream StreamProcessor, payloads map[string]typeurl.Any) (StreamProcessor, error)
StreamProcessorInit returns the initialized stream processor