Documentation ¶
Index ¶
- Variables
- func ParseS3URL(s3URL *url.URL) (config *aws.Config, bucket string, path string, err error)
- func ReadObject(ctx context.Context, fileURL string, opts ...Option) ([]byte, error)
- type AzureStore
- func (s *AzureStore) BaseURL() *url.URL
- func (s *AzureStore) Clone(_ context.Context) (Store, error)
- func (s *AzureStore) CopyObject(ctx context.Context, src, dest string) error
- func (s AzureStore) DeleteObject(ctx context.Context, base string) error
- func (s *AzureStore) FileExists(ctx context.Context, base string) (bool, error)
- func (s *AzureStore) ListFiles(ctx context.Context, prefix string, max int) ([]string, error)
- func (s *AzureStore) ObjectAttributes(ctx context.Context, base string) (*ObjectAttributes, error)
- func (s *AzureStore) ObjectPath(name string) string
- func (s *AzureStore) ObjectURL(name string) string
- func (s *AzureStore) OpenObject(ctx context.Context, name string) (out io.ReadCloser, err error)
- func (c AzureStore) Overwrite() bool
- func (s *AzureStore) PushLocalFile(ctx context.Context, localFile, toBaseName string) error
- func (c AzureStore) SetMeter(m Meter)
- func (c AzureStore) SetOverwrite(in bool)
- func (s *AzureStore) SubStore(subFolder string) (Store, error)
- func (s *AzureStore) Walk(ctx context.Context, prefix string, f func(filename string) (err error)) error
- func (s *AzureStore) WalkFrom(ctx context.Context, prefix, startingPoint string, ...) error
- func (s *AzureStore) WriteObject(ctx context.Context, base string, f io.Reader) (err error)
- type BufferedFileReadCloser
- type Clonable
- type GSStore
- func (s *GSStore) BaseURL() *url.URL
- func (s *GSStore) Clone(ctx context.Context) (Store, error)
- func (s *GSStore) CopyObject(ctx context.Context, src, dest string) error
- func (s *GSStore) DeleteObject(ctx context.Context, base string) error
- func (s *GSStore) FileExists(ctx context.Context, base string) (bool, error)
- func (s *GSStore) ListFiles(ctx context.Context, prefix string, max int) ([]string, error)
- func (s *GSStore) ObjectAttributes(ctx context.Context, base string) (*ObjectAttributes, error)
- func (s *GSStore) ObjectPath(name string) string
- func (s *GSStore) ObjectURL(name string) string
- func (s *GSStore) OpenObject(ctx context.Context, name string) (out io.ReadCloser, err error)
- func (c GSStore) Overwrite() bool
- func (s *GSStore) PushLocalFile(ctx context.Context, localFile, toBaseName string) error
- func (c GSStore) SetMeter(m Meter)
- func (c GSStore) SetOverwrite(in bool)
- func (s *GSStore) SubStore(subFolder string) (Store, error)
- func (s *GSStore) Walk(ctx context.Context, prefix string, f func(filename string) (err error)) error
- func (s *GSStore) WalkFrom(ctx context.Context, prefix, startingPoint string, ...) error
- func (s *GSStore) WriteObject(ctx context.Context, base string, f io.Reader) (err error)
- type GZipReadCloser
- type LocalStore
- func (s *LocalStore) BaseURL() *url.URL
- func (s *LocalStore) Clone(ctx context.Context) (Store, error)
- func (s *LocalStore) CopyObject(ctx context.Context, src, dest string) error
- func (s *LocalStore) DeleteObject(ctx context.Context, base string) error
- func (s *LocalStore) FileExists(ctx context.Context, base string) (bool, error)
- func (s *LocalStore) ListFiles(ctx context.Context, prefix string, max int) ([]string, error)
- func (s *LocalStore) ObjectAttributes(ctx context.Context, base string) (*ObjectAttributes, error)
- func (s *LocalStore) ObjectPath(name string) string
- func (s *LocalStore) ObjectURL(name string) string
- func (s *LocalStore) OpenObject(ctx context.Context, name string) (out io.ReadCloser, err error)
- func (c LocalStore) Overwrite() bool
- func (s *LocalStore) PushLocalFile(ctx context.Context, localFile, toBaseName string) error
- func (c LocalStore) SetMeter(m Meter)
- func (c LocalStore) SetOverwrite(in bool)
- func (s *LocalStore) SubStore(subFolder string) (Store, error)
- func (s *LocalStore) Walk(ctx context.Context, prefix string, f func(filename string) (err error)) error
- func (s *LocalStore) WalkFrom(ctx context.Context, prefix, startingPoint string, ...) error
- func (s *LocalStore) WriteObject(ctx context.Context, base string, reader io.Reader) (err error)
- type Meter
- type MockStore
- func (s *MockStore) BaseURL() *url.URL
- func (s *MockStore) CopyObject(ctx context.Context, src, dest string) error
- func (s *MockStore) DeleteObject(ctx context.Context, base string) error
- func (s *MockStore) FileExists(ctx context.Context, base string) (bool, error)
- func (s *MockStore) ListFiles(ctx context.Context, prefix string, max int) ([]string, error)
- func (s *MockStore) ObjectAttributes(ctx context.Context, base string) (*ObjectAttributes, error)
- func (s *MockStore) ObjectPath(base string) string
- func (s *MockStore) ObjectURL(base string) string
- func (s *MockStore) OpenObject(ctx context.Context, name string) (out io.ReadCloser, err error)
- func (s *MockStore) Overwrite() bool
- func (s *MockStore) PushLocalFile(ctx context.Context, localFile string, toBaseName string) (err error)
- func (s *MockStore) SetFile(name string, content []byte)
- func (s *MockStore) SetMeter(meter Meter)
- func (s *MockStore) SetOverwrite(in bool)
- func (s *MockStore) SubStore(subFolder string) (Store, error)
- func (s *MockStore) Walk(ctx context.Context, prefix string, f func(filename string) error) error
- func (s *MockStore) WalkFrom(ctx context.Context, prefix, startingPoint string, ...) error
- func (s *MockStore) WriteFiles(toDirectory string) error
- func (s *MockStore) WriteObject(ctx context.Context, base string, f io.Reader) (err error)
- type ObjectAttributes
- type Option
- type S3Store
- func (s *S3Store) BaseURL() *url.URL
- func (s *S3Store) Clone(ctx context.Context) (Store, error)
- func (s *S3Store) CopyObject(ctx context.Context, src, dest string) error
- func (s *S3Store) DeleteObject(ctx context.Context, base string) error
- func (s *S3Store) FileExists(ctx context.Context, base string) (bool, error)
- func (s *S3Store) ListFiles(ctx context.Context, prefix string, max int) ([]string, error)
- func (s *S3Store) ObjectAttributes(ctx context.Context, base string) (*ObjectAttributes, error)
- func (s *S3Store) ObjectPath(name string) string
- func (s *S3Store) ObjectURL(name string) string
- func (s *S3Store) OpenObject(ctx context.Context, name string) (out io.ReadCloser, err error)
- func (c S3Store) Overwrite() bool
- func (s *S3Store) PushLocalFile(ctx context.Context, localFile, toBaseName string) error
- func (c S3Store) SetMeter(m Meter)
- func (c S3Store) SetOverwrite(in bool)
- func (s *S3Store) SubStore(subFolder string) (Store, error)
- func (s *S3Store) Walk(ctx context.Context, prefix string, f func(filename string) (err error)) error
- func (s *S3Store) WalkFrom(ctx context.Context, prefix, startingPoint string, ...) error
- func (s *S3Store) WriteObject(ctx context.Context, base string, f io.Reader) (err error)
- type Store
- func NewDBinStore(baseURL string) (Store, error)
- func NewJSONLStore(baseURL string) (Store, error)
- func NewSimpleStore(baseURL string) (Store, error)
- func NewStore(baseURL, extension, compressionType string, overwrite bool) (Store, error)
- func NewStoreFromFileURL(fileURL string, opts ...Option) (store Store, filename string, err error)
- func OpenObject(ctx context.Context, fileURL string, opts ...Option) (out io.ReadCloser, store Store, filename string, err error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
var NewStoreFromURL = NewStoreFromFileURL
Deprecated: Use NewStoreFromFileURL
var StopIteration = errors.New("stop iteration")
Functions ¶
func ParseS3URL ¶
func ReadObject ¶
ReadObject directly reads the giving file URL by parsing the file url, extracting the path and the filename from it, creating the store interface, opening the object directly and returning all this.
This is a shortcut helper function that make it simpler to get store from a single file url.
Types ¶
type AzureStore ¶
type AzureStore struct {
// contains filtered or unexported fields
}
func NewAzureStore ¶
func (*AzureStore) BaseURL ¶
func (s *AzureStore) BaseURL() *url.URL
func (*AzureStore) Clone ¶
func (s *AzureStore) Clone(_ context.Context) (Store, error)
context not used here
func (*AzureStore) CopyObject ¶
func (s *AzureStore) CopyObject(ctx context.Context, src, dest string) error
func (AzureStore) DeleteObject ¶
func (s AzureStore) DeleteObject(ctx context.Context, base string) error
func (*AzureStore) FileExists ¶
func (*AzureStore) ObjectAttributes ¶
func (s *AzureStore) ObjectAttributes(ctx context.Context, base string) (*ObjectAttributes, error)
func (*AzureStore) ObjectPath ¶
func (s *AzureStore) ObjectPath(name string) string
func (*AzureStore) ObjectURL ¶
func (s *AzureStore) ObjectURL(name string) string
func (*AzureStore) OpenObject ¶
func (s *AzureStore) OpenObject(ctx context.Context, name string) (out io.ReadCloser, err error)
func (*AzureStore) PushLocalFile ¶
func (s *AzureStore) PushLocalFile(ctx context.Context, localFile, toBaseName string) error
func (AzureStore) SetOverwrite ¶
func (c AzureStore) SetOverwrite(in bool)
func (*AzureStore) WriteObject ¶
type BufferedFileReadCloser ¶
type BufferedFileReadCloser struct {
// contains filtered or unexported fields
}
func NewBufferedFileReadCloser ¶
func NewBufferedFileReadCloser(file *os.File) *BufferedFileReadCloser
func (*BufferedFileReadCloser) Close ¶
func (readCloser *BufferedFileReadCloser) Close() error
type GSStore ¶
type GSStore struct {
// contains filtered or unexported fields
}
func NewGSStore ¶
func (*GSStore) CopyObject ¶
func (*GSStore) DeleteObject ¶
func (*GSStore) FileExists ¶
func (*GSStore) ObjectAttributes ¶
func (*GSStore) ObjectPath ¶
func (*GSStore) OpenObject ¶
func (*GSStore) PushLocalFile ¶
func (GSStore) SetOverwrite ¶
func (c GSStore) SetOverwrite(in bool)
type GZipReadCloser ¶
func NewGZipReadCloser ¶
func NewGZipReadCloser(src io.ReadCloser) (*GZipReadCloser, error)
func (*GZipReadCloser) Close ¶
func (g *GZipReadCloser) Close() error
type LocalStore ¶
type LocalStore struct {
// contains filtered or unexported fields
}
func NewLocalStore ¶
func (*LocalStore) BaseURL ¶
func (s *LocalStore) BaseURL() *url.URL
func (*LocalStore) CopyObject ¶
func (s *LocalStore) CopyObject(ctx context.Context, src, dest string) error
func (*LocalStore) DeleteObject ¶
func (s *LocalStore) DeleteObject(ctx context.Context, base string) error
func (*LocalStore) FileExists ¶
func (*LocalStore) ObjectAttributes ¶
func (s *LocalStore) ObjectAttributes(ctx context.Context, base string) (*ObjectAttributes, error)
func (*LocalStore) ObjectPath ¶
func (s *LocalStore) ObjectPath(name string) string
func (*LocalStore) ObjectURL ¶
func (s *LocalStore) ObjectURL(name string) string
func (*LocalStore) OpenObject ¶
func (s *LocalStore) OpenObject(ctx context.Context, name string) (out io.ReadCloser, err error)
func (*LocalStore) PushLocalFile ¶
func (s *LocalStore) PushLocalFile(ctx context.Context, localFile, toBaseName string) error
func (LocalStore) SetOverwrite ¶
func (c LocalStore) SetOverwrite(in bool)
func (*LocalStore) WriteObject ¶
type MockStore ¶
type MockStore struct { OpenObjectFunc func(ctx context.Context, name string) (out io.ReadCloser, err error) WriteObjectFunc func(ctx context.Context, base string, f io.Reader) error CopyObjectFunc func(ctx context.Context, src, dest string) error DeleteObjectFunc func(ctx context.Context, base string) error FileExistsFunc func(ctx context.Context, base string) (bool, error) ObjectAttributesFunc func(ctx context.Context, base string) (*ObjectAttributes, error) ListFilesFunc func(ctx context.Context, prefix string, max int) ([]string, error) WalkFunc func(ctx context.Context, prefix string, f func(filename string) error) error PushLocalFileFunc func(ctx context.Context, localFile string, toBaseName string) (err error) Files map[string][]byte // contains filtered or unexported fields }
func NewMockStore ¶
func (*MockStore) CopyObject ¶
func (*MockStore) DeleteObject ¶
func (*MockStore) FileExists ¶
func (*MockStore) ObjectAttributes ¶
func (*MockStore) ObjectPath ¶
func (*MockStore) OpenObject ¶
func (*MockStore) PushLocalFile ¶
func (*MockStore) SetFile ¶
SetFile sets the content of a file. Set the value "err" to trigger an error when reading this file.
func (*MockStore) SetOverwrite ¶
func (*MockStore) WriteFiles ¶
WriteFiles dumps currently know file
type ObjectAttributes ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func AllowOverwrite ¶
func AllowOverwrite() Option
AllowOverwrite allow files to be overwritten when already exist at a given location.
func Compression ¶
Compression defines which kind of compression to use when creating the store instance.
Valid `compressionType` values: - <empty> No compression - zstd Use ZSTD compression - gzip Use GZIP compression
type S3Store ¶
type S3Store struct {
// contains filtered or unexported fields
}
func NewS3Store ¶
func (*S3Store) CopyObject ¶
func (*S3Store) DeleteObject ¶
func (*S3Store) FileExists ¶
func (*S3Store) ObjectAttributes ¶
func (*S3Store) ObjectPath ¶
func (*S3Store) OpenObject ¶
func (*S3Store) PushLocalFile ¶
func (S3Store) SetOverwrite ¶
func (c S3Store) SetOverwrite(in bool)
type Store ¶
type Store interface { OpenObject(ctx context.Context, name string) (out io.ReadCloser, err error) FileExists(ctx context.Context, base string) (bool, error) ObjectPath(base string) string ObjectURL(base string) string ObjectAttributes(ctx context.Context, base string) (*ObjectAttributes, error) WriteObject(ctx context.Context, base string, f io.Reader) (err error) PushLocalFile(ctx context.Context, localFile, toBaseName string) (err error) CopyObject(ctx context.Context, src, dest string) error Overwrite() bool SetOverwrite(enabled bool) WalkFrom(ctx context.Context, prefix, startingPoint string, f func(filename string) (err error)) error // Walk recursively all files starting with the given prefix within this store. The `f` callback is invoked // for each file found. // // If you return `dstore.StopIteration` from your callback, iteration stops right away and `nil` will // returned by the `Walk` function. If your callback returns any error, iteration stops right away and // callback returned error is return by the `Walk` function. Walk(ctx context.Context, prefix string, f func(filename string) (err error)) error ListFiles(ctx context.Context, prefix string, max int) ([]string, error) DeleteObject(ctx context.Context, base string) error // Used to retrieve original query parameters, allowing further // configurability of the consumers of this store. BaseURL() *url.URL SubStore(subFolder string) (Store, error) SetMeter(meter Meter) }
func NewDBinStore ¶
func NewJSONLStore ¶
func NewSimpleStore ¶
func NewStore ¶
NewStore creates a new Store instance. The baseURL is always a directory, and does not end with a `/`.
func NewStoreFromFileURL ¶
NewStoreFromFileURL works against a full file URL to derive the store from it as well as the filename it points to. Use this method **only and only if** the input points to a file directly, if your input is to build a store, use NewStore instead.
This is a shortcut helper function that make it simpler to get store from a single file url.
func OpenObject ¶
func OpenObject(ctx context.Context, fileURL string, opts ...Option) (out io.ReadCloser, store Store, filename string, err error)
OpenObject directly opens the giving file URL by parsing the file url, extracting the path and the filename from it, creating the store interface, opening the object directly and returning all this.
This is a shortcut helper function that make it simpler to get store from a single file url.