Documentation ¶
Index ¶
- func NewCAS(r io.Reader) casStore
- type CASSectionStore
- type Provider
- func (p Provider) CAS() (api.CAS, api.CloseWaitFunc, error)
- func (p Provider) CASReader() (api.CASReader, api.CloseWaitFunc, error)
- func (p Provider) CASWriter() (api.CASWriter, api.CloseWaitFunc, error)
- func (p Provider) Name() string
- func (p Provider) SinkBuilder() provider.SinkBuilder
- func (p Provider) SourceBuilder() provider.SourceBuilder
- type Reader
- type Sink
- type SinkBuilder
- func (b *SinkBuilder) Build() (api.Sink, api.CloseWaitFunc, error)
- func (b *SinkBuilder) Set(key string, value any) provider.SinkBuilder
- func (b *SinkBuilder) WithFormat(format archivetar.Format) *SinkBuilder
- func (b *SinkBuilder) WithIOWriter(w io.Writer) *SinkBuilder
- func (b *SinkBuilder) WithNewWriter(f func(io.Writer) Writer) *SinkBuilder
- func (b *SinkBuilder) WithRoot(root string) *SinkBuilder
- func (b *SinkBuilder) WithSinkRef(ref string) provider.SinkBuilder
- func (b *SinkBuilder) WithXAttrPaxPrefix(prefix string) *SinkBuilder
- type Source
- type SourceBuilder
- func (b *SourceBuilder) Build() (api.Source, api.CloseWaitFunc, error)
- func (b *SourceBuilder) WithIOReader(r io.Reader) *SourceBuilder
- func (b *SourceBuilder) WithNewReader(f func(io.Reader) Reader) *SourceBuilder
- func (b *SourceBuilder) WithSRIAlgorithm(alg sri.Algorithm) *SourceBuilder
- func (b *SourceBuilder) WithSourceRef(ref string) provider.SourceBuilder
- func (b *SourceBuilder) WithXAttrPaxPrefixes(prefixes []string) *SourceBuilder
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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) SinkBuilder ¶
func (p Provider) SinkBuilder() provider.SinkBuilder
func (Provider) SourceBuilder ¶
func (p Provider) SourceBuilder() provider.SourceBuilder
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 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.