 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- type Archive
- type ArchiveFactory
- type CompressionMethod
- type DefaultArchiveFactory
- func (e DefaultArchiveFactory) CanOpenScheme(scheme url.Scheme) bool
- func (e DefaultArchiveFactory) Open(ctx context.Context, location url.URL, password string) (Archive, error)
- func (e DefaultArchiveFactory) OpenBytes(ctx context.Context, data []byte, password string) (Archive, error)
- func (e DefaultArchiveFactory) OpenReader(ctx context.Context, reader ReaderAtCloser, size int64, password string, ...) (Archive, error)
 
- type Entry
- type GCSArchiveFactory
- func (e GCSArchiveFactory) CanOpen(scheme url.Scheme) bool
- func (e GCSArchiveFactory) Open(ctx context.Context, location url.URL, password string) (Archive, error)
- func (e GCSArchiveFactory) OpenBytes(ctx context.Context, data []byte, password string) (Archive, error)
- func (e GCSArchiveFactory) OpenReader(ctx context.Context, reader ReaderAtCloser, size int64, password string, ...) (Archive, error)
 
- type HTTPArchiveFactory
- func (e HTTPArchiveFactory) CanOpen(scheme url.Scheme) bool
- func (e HTTPArchiveFactory) Open(ctx context.Context, location url.URL, password string) (Archive, error)
- func (e HTTPArchiveFactory) OpenBytes(ctx context.Context, data []byte, password string) (Archive, error)
- func (e HTTPArchiveFactory) OpenReader(ctx context.Context, reader ReaderAtCloser, size int64, password string, ...) (Archive, error)
 
- type ReaderAtCloser
- type RemoteArchiveConfig
- type RemoteArchiveReader
- func RemoteArchiveReaderFromGCS(handle *storage.ObjectHandle, attrs *storage.ObjectAttrs) RemoteArchiveReader
- func RemoteArchiveReaderFromHTTP(client *http.Client, url url.AbsoluteURL, size int64) RemoteArchiveReader
- func RemoteArchiveReaderFromS3(client *s3.Client, output s3.HeadObjectOutput, input s3.GetObjectInput) RemoteArchiveReader
 
- type S3ArchiveFactory
- func (e S3ArchiveFactory) CanOpen(scheme url.Scheme) bool
- func (e S3ArchiveFactory) Open(ctx context.Context, location url.URL, password string) (Archive, error)
- func (e S3ArchiveFactory) OpenBytes(ctx context.Context, data []byte, password string) (Archive, error)
- func (e S3ArchiveFactory) OpenReader(ctx context.Context, reader ReaderAtCloser, size int64, password string, ...) (Archive, error)
 
- type SchemeSpecificArchiveFactory
Constants ¶
const GzipMaxLength = math.MaxUint32
    const GzipWrapperLength = 18
    Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive interface {
	Entries() []Entry                 // List of all the archived file entries.
	Entry(path string) (Entry, error) // Gets the entry at the given `path`.
	Close()
}
    Represents an immutable archive.
func NewExplodedArchive ¶
type ArchiveFactory ¶
type ArchiveFactory interface {
	Open(ctx context.Context, location url.URL, password string) (Archive, error)                                            // Opens an archive from a location.
	OpenBytes(ctx context.Context, data []byte, password string) (Archive, error)                                            // Opens an archive from a [data] slice.
	OpenReader(ctx context.Context, reader ReaderAtCloser, size int64, password string, minimizeReads bool) (Archive, error) // Opens an archive from a reader.
}
    type CompressionMethod ¶ added in v0.5.0
type CompressionMethod uint16
const ( CompressionMethodStore CompressionMethod = CompressionMethod(zip.Store) CompressionMethodDeflate CompressionMethod = CompressionMethod(zip.Deflate) )
type DefaultArchiveFactory ¶
type DefaultArchiveFactory struct {
	// contains filtered or unexported fields
}
    func NewArchiveFactory ¶
func NewArchiveFactory() DefaultArchiveFactory
func (DefaultArchiveFactory) CanOpenScheme ¶ added in v0.9.0
func (e DefaultArchiveFactory) CanOpenScheme(scheme url.Scheme) bool
CanOpenScheme implements SchemeSpecificArchiveFactory
func (DefaultArchiveFactory) Open ¶
func (e DefaultArchiveFactory) Open(ctx context.Context, location url.URL, password string) (Archive, error)
Open implements ArchiveFactory
func (DefaultArchiveFactory) OpenBytes ¶
func (e DefaultArchiveFactory) OpenBytes(ctx context.Context, data []byte, password string) (Archive, error)
OpenBytes implements ArchiveFactory
func (DefaultArchiveFactory) OpenReader ¶
func (e DefaultArchiveFactory) OpenReader(ctx context.Context, reader ReaderAtCloser, size int64, password string, minimizeReads bool) (Archive, error)
OpenBytes implements ArchiveFactory
type Entry ¶
type Entry interface {
	Path() string                                              // Absolute path to the entry in the archive.
	Length() uint64                                            // Uncompressed data length.
	CompressedLength() uint64                                  // Compressed data length.
	CompressedAs(compressionMethod CompressionMethod) bool     // Whether the entry is compressed using the given method.
	Read(start int64, end int64) ([]byte, error)               // Reads the whole content of this entry, or a portion when [start] or [end] are specified.
	Stream(w io.Writer, start int64, end int64) (int64, error) // Streams the whole content of this entry to a writer, or a portion when [start] or [end] are specified.
	StreamCompressed(w io.Writer) (int64, error)     // Streams the compressed content of this entry to a writer.
	StreamCompressedGzip(w io.Writer) (int64, error) // Streams the compressed content of this entry to a writer in a GZIP container.
	ReadCompressed() ([]byte, error)                 // Reads the compressed content of this entry.
	ReadCompressedGzip() ([]byte, error)             // Reads the compressed content of this entry inside a GZIP container.
}
    Holds an archive entry's metadata.
type GCSArchiveFactory ¶ added in v0.9.0
type GCSArchiveFactory struct {
	// contains filtered or unexported fields
}
    func NewGCSArchiveFactory ¶ added in v0.9.0
func NewGCSArchiveFactory(client *storage.Client, config RemoteArchiveConfig) GCSArchiveFactory
func (GCSArchiveFactory) CanOpen ¶ added in v0.9.0
func (e GCSArchiveFactory) CanOpen(scheme url.Scheme) bool
CanOpen implements SchemeSpecificArchiveFactory
func (GCSArchiveFactory) Open ¶ added in v0.9.0
func (e GCSArchiveFactory) Open(ctx context.Context, location url.URL, password string) (Archive, error)
Open implements ArchiveFactory
func (GCSArchiveFactory) OpenBytes ¶ added in v0.9.0
func (e GCSArchiveFactory) OpenBytes(ctx context.Context, data []byte, password string) (Archive, error)
OpenBytes implements ArchiveFactory
func (GCSArchiveFactory) OpenReader ¶ added in v0.9.0
func (e GCSArchiveFactory) OpenReader(ctx context.Context, reader ReaderAtCloser, size int64, password string, minimizeReads bool) (Archive, error)
OpenReader implements ArchiveFactory
type HTTPArchiveFactory ¶ added in v0.9.0
type HTTPArchiveFactory struct {
	// contains filtered or unexported fields
}
    func NewHTTPArchiveFactory ¶ added in v0.9.0
func NewHTTPArchiveFactory(client *http.Client, config RemoteArchiveConfig) HTTPArchiveFactory
func (HTTPArchiveFactory) CanOpen ¶ added in v0.9.0
func (e HTTPArchiveFactory) CanOpen(scheme url.Scheme) bool
CanOpen implements SchemeSpecificArchiveFactory
func (HTTPArchiveFactory) Open ¶ added in v0.9.0
func (e HTTPArchiveFactory) Open(ctx context.Context, location url.URL, password string) (Archive, error)
Open implements ArchiveFactory
func (HTTPArchiveFactory) OpenBytes ¶ added in v0.9.0
func (e HTTPArchiveFactory) OpenBytes(ctx context.Context, data []byte, password string) (Archive, error)
OpenBytes implements ArchiveFactory
func (HTTPArchiveFactory) OpenReader ¶ added in v0.9.0
func (e HTTPArchiveFactory) OpenReader(ctx context.Context, reader ReaderAtCloser, size int64, password string, minimizeReads bool) (Archive, error)
OpenReader implements ArchiveFactory
type RemoteArchiveConfig ¶ added in v0.9.0
type RemoteArchiveConfig struct {
	Timeout             time.Duration // Timeout for remote requests to read from the archive
	CacheAllThreshold   int64         // Threshold for caching the entire ZIP
	CacheSizeThreshold  int64         // Threshold for caching of a single entry in the ZIP
	CacheCountThreshold int64         // Threshold for the number of entries in the ZIP to cache
}
    func NewDefaultRemoteArchiveConfig ¶ added in v0.9.0
func NewDefaultRemoteArchiveConfig() RemoteArchiveConfig
func (RemoteArchiveConfig) Empty ¶ added in v0.9.0
func (c RemoteArchiveConfig) Empty() bool
type RemoteArchiveReader ¶ added in v0.9.0
type RemoteArchiveReader interface {
	Size() int64                                                                // Size of the remote archive object
	ReadRange(ctx context.Context, offset, length int64) (io.ReadCloser, error) // Negative length means "read to the end"
}
    func RemoteArchiveReaderFromGCS ¶ added in v0.9.0
func RemoteArchiveReaderFromGCS(handle *storage.ObjectHandle, attrs *storage.ObjectAttrs) RemoteArchiveReader
func RemoteArchiveReaderFromHTTP ¶ added in v0.9.0
func RemoteArchiveReaderFromHTTP(client *http.Client, url url.AbsoluteURL, size int64) RemoteArchiveReader
func RemoteArchiveReaderFromS3 ¶ added in v0.9.0
func RemoteArchiveReaderFromS3(client *s3.Client, output s3.HeadObjectOutput, input s3.GetObjectInput) RemoteArchiveReader
type S3ArchiveFactory ¶ added in v0.9.0
type S3ArchiveFactory struct {
	// contains filtered or unexported fields
}
    func NewS3ArchiveFactory ¶ added in v0.9.0
func NewS3ArchiveFactory(client *s3.Client, config RemoteArchiveConfig) S3ArchiveFactory
func (S3ArchiveFactory) CanOpen ¶ added in v0.9.0
func (e S3ArchiveFactory) CanOpen(scheme url.Scheme) bool
CanOpen implements SchemeSpecificArchiveFactory
func (S3ArchiveFactory) Open ¶ added in v0.9.0
func (e S3ArchiveFactory) Open(ctx context.Context, location url.URL, password string) (Archive, error)
Open implements ArchiveFactory
func (S3ArchiveFactory) OpenBytes ¶ added in v0.9.0
func (e S3ArchiveFactory) OpenBytes(ctx context.Context, data []byte, password string) (Archive, error)
OpenBytes implements ArchiveFactory
func (S3ArchiveFactory) OpenReader ¶ added in v0.9.0
func (e S3ArchiveFactory) OpenReader(ctx context.Context, reader ReaderAtCloser, size int64, password string, minimizeReads bool) (Archive, error)
OpenReader implements ArchiveFactory