httpfs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const FilestoreType = "http"

FilestoreType uniquely identifies this filestore

Variables

This section is empty.

Functions

func NewFS

func NewFS(cfgMap map[string]interface{}, opts ...Option) (qfs.Filesystem, error)

NewFS creates a new local filesytem PathResolver

func NewFilesystem added in v0.4.2

func NewFilesystem(_ context.Context, cfgMap map[string]interface{}) (qfs.Filesystem, error)

NewFilesystem creates a new http filesystem PathResolver

Types

type FS

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

FS is a implementation of qfs.PathResolver that uses the local filesystem

func (*FS) Delete added in v0.4.2

func (httpfs *FS) Delete(ctx context.Context, path string) (err error)

Delete removes a file or directory from the filesystem

func (*FS) Get

func (httpfs *FS) Get(ctx context.Context, path string) (qfs.File, error)

Get implements qfs.PathResolver

func (*FS) Has added in v0.6.0

func (https *FS) Has(ctx context.Context, path string) (bool, error)

Has returns whether the store has a File with the key https has no caching strategy, so it'll always return false

func (*FS) Put added in v0.4.2

func (httpfs *FS) Put(ctx context.Context, file qfs.File) (resultPath string, err error)

Put places a file or directory on the filesystem, returning the root path. The returned path may or may not honor the path of the given file

func (*FS) Type added in v0.4.2

func (httpfs *FS) Type() string

Type distinguishes this filesystem from others by a unique string prefix

type FSConfig

type FSConfig struct {
	Client *http.Client // client to use to make requests
}

FSConfig adjusts the behaviour of an FS instance

func DefaultFSConfig

func DefaultFSConfig() *FSConfig

DefaultFSConfig is the configuration state with no additional options consumers of this package typically don't need to use this

type HTTPResFile

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

HTTPResFile implements qfs.File with a filesystem file

func (*HTTPResFile) Close

func (rf *HTTPResFile) Close() error

Close proxies to the response body reader

func (*HTTPResFile) FileName

func (rf *HTTPResFile) FileName() string

FileName returns a filename associated with this file

func (*HTTPResFile) FullPath

func (rf *HTTPResFile) FullPath() string

FullPath returns the full path used when adding this file

func (*HTTPResFile) IsDirectory

func (rf *HTTPResFile) IsDirectory() bool

IsDirectory satisfies the qfs.File interface

func (*HTTPResFile) MediaType added in v0.4.2

func (rf *HTTPResFile) MediaType() string

MediaType gets the value of the Content-Type response header

func (*HTTPResFile) ModTime added in v0.4.2

func (rf *HTTPResFile) ModTime() time.Time

ModTime gets the last time of modification. currently not implemented for HTTP TODO (b5) - finish

func (*HTTPResFile) NextFile

func (rf *HTTPResFile) NextFile() (qfs.File, error)

NextFile satisfies the qfs.File interface

func (*HTTPResFile) Read

func (rf *HTTPResFile) Read(p []byte) (int, error)

Read proxies to the response body reader

type Option

type Option func(cfg *FSConfig)

Option is a function type for passing to NewFS

func OptionSetHTTPClient

func OptionSetHTTPClient(cli *http.Client) Option

OptionSetHTTPClient sets the http client to use

Jump to

Keyboard shortcuts

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