zipfile

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedURLScheme = errors.New("Unsupported URL scheme")
)

Errors that might be returned outside the package.

Functions

This section is empty.

Types

type Provider

type Provider interface {
	// Get returns a zip.Reader pointer based on the latest copy of the data the
	// provider refers to. It may be called multiple times, and caching is left
	// up to the individual Provider implementation.
	Get(ctx context.Context) (*zip.Reader, error)
}

Provider is the interface implemented by everything that can return a zip.Reader.

func FromURL

func FromURL(ctx context.Context, u *url.URL) (Provider, error)

FromURL returns a new zipfile.Provider based on the passed-in URL. Supported URL schemes are currently: gs://bucket/filename and file:localpath . Whether the path contained in the URL is valid isn't known until the Get() method of the returned Provider is called. Unsupported URL schemes cause this to return ErrUnsupportedURLScheme.

Users interested in having the daemon download the data directly from MaxMind should implement an https case in the below handler. M-Lab doesn't need that case because we cache MaxMind's data to reduce load on their servers and to eliminate a runtime dependency on a third party service.

Jump to

Keyboard shortcuts

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