archive

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 10 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

This section is empty.

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) AddFrom

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

AddFrom reads files into the bundle

func (*Bundle) Delete

func (b *Bundle) Delete(label string)

Delete will remove files from the bundle by label

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) 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

type BundleDecoder struct {
	bytes.Buffer
}

BundleDecoder is used to decode bundle objects from a reader

func NewBundleDecoder

func NewBundleDecoder() *BundleDecoder

NewBundleDecoder ...

func (*BundleDecoder) Decode

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

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

func (*BundleDecoder) DecodeFrom

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

DecodeFrom a bundle object

func (*BundleDecoder) FileType

func (d *BundleDecoder) FileType() string

FileType in plain text

type BundleEncoder

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

BundleEncoder is used to write bundles to io.Writer

func NewBundleEncoder

func NewBundleEncoder(w io.Writer) *BundleEncoder

NewBundleEncoder ...

func (*BundleEncoder) Encode

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

Encode to the internal writer

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