archive

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package archive provides the logic for Gatecheck Bundles

Index

Constants

View Source
const BundleVersion = "1"

BundleVersion the version support by this archive format

View Source
const DefaultBundleFilename = "gatecheck-bundle.tar.gz"

DefaultBundleFilename the bundle name to be used as a default

View Source
const FileType = "Gatecheck Bundle"

FileType in plain text

View Source
const ManifestFilename = "gatecheck-manifest.json"

ManifestFilename the file name to be used as a default

Variables

This section is empty.

Functions

func TarGzipBundle added in v0.4.0

func TarGzipBundle(dst io.Writer, bundle *Bundle) (int64, error)

func UntarGzipBundle added in v0.4.0

func UntarGzipBundle(src io.Reader, bundle *Bundle) error

Types

type Bundle

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

Bundle uses tar and gzip to collect reports and files into a single file

func NewBundle

func NewBundle() *Bundle

NewBundle ...

func (*Bundle) Add added in v0.4.0

func (b *Bundle) Add(content []byte, label string, tags []string)

func (*Bundle) AddFrom

func (b *Bundle) AddFrom(r io.Reader, label string, properties map[string]string) error

AddFrom reads files into the bundle

func (*Bundle) Content added in v0.4.0

func (b *Bundle) Content() string

func (*Bundle) Delete deprecated

func (b *Bundle) Delete(label string)

Delete will remove files from the bundle by label

Deprecated: use Remove

func (*Bundle) FileBytes added in v0.4.0

func (b *Bundle) FileBytes(fileLabel string) []byte

func (*Bundle) FileSize

func (b *Bundle) FileSize(fileLabel string) int

FileSize get the file size for a specific label

func (*Bundle) Manifest

func (b *Bundle) Manifest() Manifest

Manifest generated by the bundle

func (*Bundle) Remove added in v0.4.0

func (b *Bundle) Remove(label string)

Remove a file from the bundle and manifest by label

If the file doesn't exist, it will log a warning

func (*Bundle) WriteFileTo

func (b *Bundle) WriteFileTo(w io.Writer, fileLabel string) (int64, error)

WriteFileTo Used to write files inside of the bundle to a writer

type BundleDecoder deprecated

type BundleDecoder struct {
	bytes.Buffer
}

BundleDecoder is used to decode bundle objects from a reader

Deprecated: Use TarGzipBundle function instead

func NewBundleDecoder deprecated

func NewBundleDecoder() *BundleDecoder

NewBundleDecoder ...

Deprecated: Use TarGzipBundle function instead

func (*BundleDecoder) Decode deprecated

func (d *BundleDecoder) Decode() (any, error)

Decode will gunzip and untar the bundle into an object, follows generic decoder pattern

Deprecated: Use TarGzipBundle function instead

func (*BundleDecoder) DecodeFrom deprecated

func (d *BundleDecoder) DecodeFrom(r io.Reader) (any, error)

DecodeFrom a bundle object

Deprecated: Use TarGzipBundle function instead

func (*BundleDecoder) FileType deprecated

func (d *BundleDecoder) FileType() string

FileType in plain text

Deprecated: Use TarGzipBundle function instead

type BundleEncoder

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

BundleEncoder is used to write bundles to io.Writer

func NewBundleEncoder deprecated

func NewBundleEncoder(w io.Writer) *BundleEncoder

NewBundleEncoder ...

Deprecated: Use TarGzipBundle function instead

func (*BundleEncoder) Encode deprecated

func (b *BundleEncoder) Encode(bundle *Bundle) error

Encode to the internal writer

Deprecated: Use TarGzipBundle function instead

type Manifest added in v0.2.0

type Manifest struct {
	Created time.Time                 `json:"createdAt"`
	Version string                    `json:"version"`
	Files   map[string]fileDescriptor `json:"files"`
}

Manifest is created and loaded into a bundle which contains information on the files

Jump to

Keyboard shortcuts

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