tar

package
v0.0.0-...-e9e1808 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: ISC Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCAS

func NewCAS(r io.Reader) casStore

Types

type CASSectionStore

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

CASSectionStore is a store for tar sections. It spies on the original reader and stores the offset and size of the section. While reading the tar file. Later, the sections can be opened by their sri.

func (*CASSectionStore) Open

func (c *CASSectionStore) Open(sri string) (io.ReadCloser, error)

Open returns a reader for the given sri.

func (*CASSectionStore) Record

func (c *CASSectionStore) Record(fileReader io.Reader, headerSize int64, sriAlgorithm sri.Algorithm) (string, error)

Record records the given file and returns the sri. The headerSize is the file size reported by the tar header.

func (*CASSectionStore) Set

func (c *CASSectionStore) Set(sri string, offset, size int64)

Set sets the offset and size for the given sri. If the sri already exists, the old location will be kept.

type Provider

type Provider struct{}

func (Provider) CAS

func (p Provider) CAS() (api.CAS, api.CloseWaitFunc, error)

func (Provider) CASReader

func (p Provider) CASReader() (api.CASReader, api.CloseWaitFunc, error)

func (Provider) CASWriter

func (p Provider) CASWriter() (api.CASWriter, api.CloseWaitFunc, error)

func (Provider) Name

func (p Provider) Name() string

func (Provider) SinkBuilder

func (p Provider) SinkBuilder() provider.SinkBuilder

func (Provider) SourceBuilder

func (p Provider) SourceBuilder() provider.SourceBuilder

type Reader

type Reader interface {
	Next() (*archivetar.Header, error)
	io.Reader
}

type Sink

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

func (*Sink) Consume

func (s *Sink) Consume(in fs.FS) error

type SinkBuilder

type SinkBuilder struct {
	NewWriter func(io.Writer) Writer
	// Format is the tar format to use.
	// Valid values are FormatPAX, FormatGNU, FormatUSTAR.
	// By default, FormatPAX is used.
	// Other formats are not able to store all metadata and are thus lossy.
	Format archivetar.Format `abstractfs:"tar-format"`
	// Root is the root directory of the tar archive.
	// Common values are "" (skip over root directory), "/" or "." (write a root directory).
	Root string `abstractfs:"root"`
	// XattrPaxPrefix is the prefix to use for xattrs.
	// By default, the "SHILY.xattr." prefix is used.
	XAttrPaxPrefix string `abstractfs:"xattr-prefix"`
	// Path is the path to write the tar to.
	// If Path is set, the tar is written to the file.
	// Otherwise, the tar is written to the io.Writer.
	Path string
	// IOWriter is the io.Writer to write the tar to.
	// If IOWriter is set, the tar is written to the io.Writer.
	// Otherwise, the tar is written to the file specified by Path.
	IOWriter io.Writer
	// contains filtered or unexported fields
}

func (*SinkBuilder) Build

func (b *SinkBuilder) Build() (api.Sink, api.CloseWaitFunc, error)

Build builds the options.

func (*SinkBuilder) Set

func (b *SinkBuilder) Set(key string, value any) provider.SinkBuilder

Set sets a option.

func (*SinkBuilder) WithFormat

func (b *SinkBuilder) WithFormat(format archivetar.Format) *SinkBuilder

func (*SinkBuilder) WithIOWriter

func (b *SinkBuilder) WithIOWriter(w io.Writer) *SinkBuilder

func (*SinkBuilder) WithNewWriter

func (b *SinkBuilder) WithNewWriter(f func(io.Writer) Writer) *SinkBuilder

func (*SinkBuilder) WithRoot

func (b *SinkBuilder) WithRoot(root string) *SinkBuilder

func (*SinkBuilder) WithSinkRef

func (b *SinkBuilder) WithSinkRef(ref string) provider.SinkBuilder

WithSinkRef sets the sink reference. For the tar provider, the source reference is the path to the tar file.

func (*SinkBuilder) WithXAttrPaxPrefix

func (b *SinkBuilder) WithXAttrPaxPrefix(prefix string) *SinkBuilder

type Source

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

func (*Source) Next

func (s *Source) Next() (api.SourceNode, error)

type SourceBuilder

type SourceBuilder struct {
	SRIAlgorithm sri.Algorithm `abstractfs:"cas-algorithm"`
	NewReader    func(io.Reader) Reader
	// XAttrPaxPrefixes is a list of prefixes that are used to identify xattrs
	// later prefixes override earlier ones if the same xattr is set multiple times.
	XAttrPaxPrefixes []string `abstractfs:"xattr-prefixes"`
	Path             string
	IOReader         io.Reader
	// contains filtered or unexported fields
}

func (*SourceBuilder) Build

func (b *SourceBuilder) Build() (api.Source, api.CloseWaitFunc, error)

Build builds the options.

func (*SourceBuilder) WithIOReader

func (b *SourceBuilder) WithIOReader(r io.Reader) *SourceBuilder

func (*SourceBuilder) WithNewReader

func (b *SourceBuilder) WithNewReader(f func(io.Reader) Reader) *SourceBuilder

func (*SourceBuilder) WithSRIAlgorithm

func (b *SourceBuilder) WithSRIAlgorithm(alg sri.Algorithm) *SourceBuilder

func (*SourceBuilder) WithSourceRef

func (b *SourceBuilder) WithSourceRef(ref string) provider.SourceBuilder

WithSourceRef sets the source reference. For the tar provider, the source reference is the path to the tar file.

func (*SourceBuilder) WithXAttrPaxPrefixes

func (b *SourceBuilder) WithXAttrPaxPrefixes(prefixes []string) *SourceBuilder

WithXAttrPaxPrefixes sets the xattr prefixes that are used to identify xattrs. Later prefixes override earlier ones if the same xattr is set multiple times. By default, the "SHILY.xattr." prefix is used. If set to []string{}, no xattrs are read.

type Writer

type Writer interface {
	Close() error
	Flush() error
	WriteHeader(hdr *archivetar.Header) error
	io.Writer
}

Jump to

Keyboard shortcuts

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