Documentation
¶
Overview ¶
Package dataexporter provides interfaces and implementations for exporting blockchain node data to cloud storage providers.
Index ¶
Constants ¶
View Source
const ( DefaultSizeLimit = "5TB" DefaultPartSize = "500GB" DefaultChunkSize = "250MB" DefaultBufferSize = "32MB" DefaultReportPeriod = time.Second DefaultConcurrentJobs = 10 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeleteOption ¶
type DeleteOption func(*DeleteOptions)
func WithConcurrentDeleteJobs ¶
func WithConcurrentDeleteJobs(concurrentJobs int) DeleteOption
type DeleteOptions ¶
type DeleteOptions struct {
ConcurrentJobs int
}
type Exporter ¶
type Exporter interface {
// Provider returns the cloud storage provider type.
Provider() Provider
// Upload uploads a directory as a compressed tarball to the specified bucket.
// The name parameter specifies the object name in the bucket.
// Options can be provided to customize the upload behavior.
Upload(dir, bucket, name string, opts ...UploadOption) error
// Delete removes an object from the specified bucket.
// Options can be provided to customize the delete behavior.
Delete(bucket, name string, opts ...DeleteOption) error
}
Exporter provides methods to upload and delete data snapshots from cloud storage.
func FromProvider ¶
FromProvider creates an Exporter for the specified provider. Returns an error if the provider is not supported.
type GcsExporter ¶
type GcsExporter struct {
// contains filtered or unexported fields
}
func NewGcsExporter ¶
func NewGcsExporter() (*GcsExporter, error)
func (*GcsExporter) Delete ¶
func (gcs *GcsExporter) Delete(bucket, name string, opts ...DeleteOption) error
func (*GcsExporter) Provider ¶
func (gcs *GcsExporter) Provider() Provider
func (*GcsExporter) Upload ¶
func (gcs *GcsExporter) Upload(dir, bucket, name string, opts ...UploadOption) error
type Provider ¶
type Provider string
Provider identifies a cloud storage provider.
const ( GCS Provider = "gcs" CompositionBatchLimit = 32 )
type UploadOption ¶
type UploadOption func(*UploadOptions)
func WithBufferSize ¶
func WithBufferSize(size string) UploadOption
func WithChunkSize ¶
func WithChunkSize(size string) UploadOption
func WithConcurrentUploadJobs ¶
func WithConcurrentUploadJobs(concurrentJobs int) UploadOption
func WithPartSize ¶
func WithPartSize(size string) UploadOption
func WithReportPeriod ¶
func WithReportPeriod(period time.Duration) UploadOption
func WithSizeLimit ¶
func WithSizeLimit(size string) UploadOption
Click to show internal directories.
Click to hide internal directories.