Documentation
¶
Overview ¶
Package dataexporter provides interfaces and implementations for exporting blockchain node data to cloud storage providers.
Index ¶
Constants ¶
const ( GCS Provider = "gcs" CompositionBatchLimit int = 32 )
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)
DeleteOption is a functional option for configuring deletions.
func WithConcurrentDeleteJobs ¶
func WithConcurrentDeleteJobs(concurrentJobs int) DeleteOption
WithConcurrentDeleteJobs sets the number of concurrent delete workers.
type DeleteOptions ¶
type DeleteOptions struct {
ConcurrentJobs int
}
DeleteOptions configures the behavior of data deletion from cloud storage.
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
}
GcsExporter implements Exporter for Google Cloud Storage.
func NewGcsExporter ¶
func NewGcsExporter() (*GcsExporter, error)
NewGcsExporter creates a new GCS exporter using application default credentials.
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 UploadOption ¶
type UploadOption func(*UploadOptions)
UploadOption is a functional option for configuring uploads.
func WithBufferSize ¶
func WithBufferSize(size string) UploadOption
WithBufferSize sets the buffer size for upload operations.
func WithChunkSize ¶
func WithChunkSize(size string) UploadOption
WithChunkSize sets the chunk size for uploads.
func WithConcurrentUploadJobs ¶
func WithConcurrentUploadJobs(concurrentJobs int) UploadOption
WithConcurrentUploadJobs sets the number of concurrent upload workers.
func WithPartSize ¶
func WithPartSize(size string) UploadOption
WithPartSize sets the part size for multi-part uploads.
func WithReportPeriod ¶
func WithReportPeriod(period time.Duration) UploadOption
WithReportPeriod sets how often progress is reported.
func WithSizeLimit ¶
func WithSizeLimit(size string) UploadOption
WithSizeLimit sets the maximum size before splitting into parts.