dstore package - github.com/streamingfast/dstore - Go Packages
- Variables
- func FileNameFromContext(ctx context.Context) string
- func ParseS3URL(s3URL *url.URL) (configOptions []func(*awsconfig.LoadOptions) error, ...)
- func ReadObject(ctx context.Context, fileURL string, opts ...Option) ([]byte, error)
- func StoreTypeFromContext(ctx context.Context) string
- type AzureStore
- func (s *AzureStore) BaseURL() *url.URL
- func (s *AzureStore) Clone(ctx context.Context, opts ...Option) (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 (s *AzureStore) SetMetadata(ctx context.Context, base string, metadata map[string]string) error
- func (c AzureStore) SetMeter(meter Meter)deprecated
- 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) WalkFromTo(ctx context.Context, prefix, startingPoint, exclusiveEndPoint string, ...) error
- func (s *AzureStore) WriteObject(ctx context.Context, base string, f io.Reader, metadataKeyValues ...string) (err error)
- type BufferedFileReadCloser
- type Clonable
- type GSStore
- func (s *GSStore) BaseURL() *url.URL
- func (s *GSStore) Clone(ctx context.Context, opts ...Option) (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 (s *GSStore) SetMetadata(ctx context.Context, base string, metadata map[string]string) error
- func (c GSStore) SetMeter(meter Meter)deprecated
- 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) WalkFromTo(ctx context.Context, prefix, startingPoint, exclusiveEndPoint string, ...) error
- func (s *GSStore) WriteObject(ctx context.Context, base string, f io.Reader, metadataKeyValues ...string) (err error)
- type GZipReadCloser
- type LocalStore
- func (s *LocalStore) BaseURL() *url.URL
- func (s *LocalStore) Clone(ctx context.Context, opts ...Option) (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 (s *LocalStore) SetMetadata(ctx context.Context, base string, metadata map[string]string) error
- func (c LocalStore) SetMeter(meter Meter)deprecated
- 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) WalkFromTo(ctx context.Context, prefix, startingPoint, exclusiveEndPoint string, ...) error
- func (s *LocalStore) WriteObject(ctx context.Context, base string, reader io.Reader, ...) (err error)
- type MemoryStore
- func (m *MemoryStore) BaseURL() *url.URL
- func (m *MemoryStore) Clone(ctx context.Context, opts ...Option) (Store, error)
- func (m *MemoryStore) CopyObject(_ context.Context, src, dest string) error
- func (m *MemoryStore) DeleteObject(ctx context.Context, base string) error
- func (m *MemoryStore) FileExists(_ context.Context, base string) (bool, error)
- func (m *MemoryStore) ListFiles(ctx context.Context, prefix string, max int) ([]string, error)
- func (m *MemoryStore) ObjectAttributes(_ context.Context, base string) (*ObjectAttributes, error)
- func (m *MemoryStore) ObjectPath(name string) string
- func (m *MemoryStore) ObjectURL(name string) string
- func (m *MemoryStore) OpenObject(ctx context.Context, name string) (out io.ReadCloser, err error)
- func (c MemoryStore) Overwrite() bool
- func (m *MemoryStore) PushLocalFile(ctx context.Context, localFile, toBaseName string) (err error)
- func (m *MemoryStore) SetMetadata(ctx context.Context, base string, metadata map[string]string) error
- func (c MemoryStore) SetMeter(meter Meter)deprecated
- func (c MemoryStore) SetOverwrite(in bool)
- func (m *MemoryStore) SubStore(subFolder string) (Store, error)
- func (m *MemoryStore) Walk(ctx context.Context, prefix string, f func(filename string) (err error)) error
- func (m *MemoryStore) WalkFrom(_ context.Context, prefix, startingPoint string, ...) error
- func (m *MemoryStore) WalkFromTo(_ context.Context, prefix, startingPoint, exclusiveEndPoint string, ...) error
- func (m *MemoryStore) WriteObject(ctx context.Context, base string, f io.Reader, metadataKeyValues ...string) (err error)
- type Meterdeprecated
- 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) SetMetadata(ctx context.Context, base string, metadata map[string]string) error
- func (_ *MockStore) SetMeter(_ Meter)deprecated
- 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) WalkFromTo(ctx context.Context, prefix, startingPoint, exclusiveEndPoint string, ...) error
- func (s *MockStore) WriteFiles(toDirectory string) error
- func (s *MockStore) WriteObject(ctx context.Context, base string, f io.Reader, metadataKeyValues ...string) (err error)
- type ObjectAttributes
- type Option
- func AllowOverwrite() Option
- func Compression(compressionType string) Option
- func WithCompressedReadCallback(cb func(context.Context, int)) Option
- func WithCompressedWriteCallback(cb func(context.Context, int)) Option
- func WithUncompressedReadCallback(cb func(context.Context, int)) Option
- func WithUncompressedWriteCallback(cb func(context.Context, int)) Option
- type S3Store
- func (s *S3Store) BaseURL() *url.URL
- func (s *S3Store) Clone(ctx context.Context, opts ...Option) (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 (s *S3Store) SetMetadata(ctx context.Context, base string, metadata map[string]string) error
- func (c S3Store) SetMeter(meter Meter)deprecated
- 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) WalkFromTo(ctx context.Context, prefix, startingPoint, exclusiveEndPoint string, ...) error
- func (s *S3Store) WriteObject(ctx context.Context, base string, f io.Reader, metadataKeyValues ...string) (err error)
- type Store
- func NewDBinStore(baseURL string, opts ...Option) (Store, error)
- func NewJSONLStore(baseURL string, opts ...Option) (Store, error)
- func NewSimpleStore(baseURL string, opts ...Option) (Store, error)
- func NewStore(baseURL, extension, compressionType string, overwrite bool, opts ...Option) (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)
This section is empty.
Deprecated: Use NewStoreFromFileURL
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.
type AzureStore struct {
}
func (c AzureStore) Overwrite() bool
func (c AzureStore) SetMeter(meter Meter)
Deprecated: Use the Options to add callbacks to inject metering from the upstream code instead
func (c AzureStore) SetOverwrite(in bool)
type BufferedFileReadCloser struct {
}
func NewBufferedFileReadCloser(file *os.File) *BufferedFileReadCloser
func (c GSStore) Overwrite() bool
func (c GSStore) SetMeter(meter Meter)
Deprecated: Use the Options to add callbacks to inject metering from the upstream code instead
func (c GSStore) SetOverwrite(in bool)
type LocalStore struct {
}
func (c LocalStore) Overwrite() bool
func (c LocalStore) SetMeter(meter Meter)
Deprecated: Use the Options to add callbacks to inject metering from the upstream code instead
func (c LocalStore) SetOverwrite(in bool)
type MemoryStore struct {
}
MemoryStore is a store that keeps all data in memory. Useful for unit testing where a store is required. Work in progress, not all methods are implemented
func (c MemoryStore) Overwrite() bool
func (c MemoryStore) SetMeter(meter Meter)
Deprecated: Use the Options to add callbacks to inject metering from the upstream code instead
func (c MemoryStore) SetOverwrite(in bool)
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, metadataKeyValues ...string) 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)
SetMetadataFunc func(ctx context.Context, base string, metadata map[string]string) 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
WalkFromFunc func(ctx context.Context, prefix, startingPoint string, f func(filename string) error) error
WalkFromToFunc func(ctx context.Context, prefix, startingPoint, exclusiveEndPoint string, f func(filename string) error) error
PushLocalFileFunc func(ctx context.Context, localFile string, toBaseName string) (err error)
Files map[string][]byte
Metadata map[string]map[string]string
}
SetFile sets the content of a file. Set the value "err" to trigger an error when reading this file.
WriteFiles dumps currently know file
type Option interface {
}
func AllowOverwrite() Option
AllowOverwrite allow files to be overwritten when already exist at a given location.
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
WithCompressedReadCallback allows you to set a callback function that is invoked when a compressed read operation is performed.
WithCompressedWriteCallback allows you to set a callback function that is invoked when a compressed write operation is performed.
WithUncompressedReadCallback allows you to set a callback function that is invoked when an uncompressed read operation is performed.
WithUncompressedWriteCallback allows you to set a callback function that is invoked when an uncompressed write operation is performed.
func (c S3Store) Overwrite() bool
func (c S3Store) SetMeter(meter Meter)
Deprecated: Use the Options to add callbacks to inject metering from the upstream code instead
func (c S3Store) SetOverwrite(in bool)
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)
SetMetadata(ctx context.Context, base string, metadata map[string]string) error
WriteObject(ctx context.Context, base string, f io.Reader, metadataKeyValues ...string) (err error)
PushLocalFile(ctx context.Context, localFile, toBaseName string) (err error)
CopyObject(ctx context.Context, src, dest string) error
Overwrite() bool
SetOverwrite(enabled bool)
Walk(ctx context.Context, prefix string, f func(filename string) (err error)) error
WalkFrom(ctx context.Context, prefix, inclusiveFrom string, f func(filename string) (err error)) error
WalkFromTo(ctx context.Context, prefix, inclusiveFrom, exclusiveTo 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
BaseURL() *url.URL
SubStore(subFolder string) (Store, error)
SetMeter(meter Meter)
}
func NewStore(baseURL, extension, compressionType string, overwrite bool, opts ...Option) (Store, error)
NewStore creates a new Store instance. The baseURL is always a directory, and does not end with a `/`.
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.
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.