dataranges

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 20MB minimum part size for S3 multipart upload
	MinPartSize = 20 * 1024 * 1024
	// 100MB maximum part size to keep reasonable number of parts
	MaxPartSize = 100 * 1024 * 1024
	// Maximum number of parts allowed by S3
	MaxParts = 10000
)

Variables

View Source
var ErrDatarangeOverlap = fmt.Errorf("datarange overlaps with existing dataranges")
View Source
var ErrInsufficientDataranges = fmt.Errorf("range must contain at least two dataranges")
View Source
var ErrRangeNotFullyCovered = fmt.Errorf("range is not fully covered by existing dataranges")

Functions

This section is empty.

Types

type CancelAggregateRequest added in v0.1.3

type CancelAggregateRequest struct {
	AggregateUploadID int64 `json:"aggregate_upload_id"`
}

type CancelUploadRequest

type CancelUploadRequest struct {
	DatarangeUploadID int64 `json:"datarange_upload_id"`
}

type CompleteAggregateRequest added in v0.1.3

type CompleteAggregateRequest struct {
	AggregateUploadID int64    `json:"aggregate_upload_id"`
	UploadIDs         []string `json:"upload_ids,omitempty"` // Only used for multipart uploads
}

type CompleteUploadRequest

type CompleteUploadRequest struct {
	DatarangeUploadID int64    `json:"datarange_upload_id"`
	UploadIDs         []string `json:"upload_ids,omitempty"` // Only used for multipart uploads
}

type DatarangeDownloadURL added in v0.1.3

type DatarangeDownloadURL struct {
	DatarangeID       int64  `json:"datarange_id"`
	DataObjectKey     string `json:"data_object_key"`
	IndexObjectKey    string `json:"index_object_key"`
	MinDatapointKey   int64  `json:"min_datapoint_key"`
	MaxDatapointKey   int64  `json:"max_datapoint_key"`
	SizeBytes         int64  `json:"size_bytes"`
	PresignedDataURL  string `json:"presigned_data_url"`
	PresignedIndexURL string `json:"presigned_index_url"`
}

type DatarangeInfo added in v0.1.5

type DatarangeInfo struct {
	DatarangeID     int64  `json:"datarange_id"`
	DataObjectKey   string `json:"data_object_key"`
	IndexObjectKey  string `json:"index_object_key"`
	MinDatapointKey int64  `json:"min_datapoint_key"`
	MaxDatapointKey int64  `json:"max_datapoint_key"`
	SizeBytes       int64  `json:"size_bytes"`
}

type DeleteDatarangeRequest

type DeleteDatarangeRequest struct {
	Datas3tName       string `json:"datas3t_name"`
	FirstDatapointKey uint64 `json:"first_datapoint_key"`
	LastDatapointKey  uint64 `json:"last_datapoint_key"`
}

func (*DeleteDatarangeRequest) Validate

func (r *DeleteDatarangeRequest) Validate(ctx context.Context) error

type ListDatarangesRequest added in v0.1.5

type ListDatarangesRequest struct {
	Datas3tName string `json:"datas3t_name"`
}

func (*ListDatarangesRequest) Validate added in v0.1.5

func (r *ListDatarangesRequest) Validate(ctx context.Context) error

type ListDatarangesResponse added in v0.1.5

type ListDatarangesResponse struct {
	Dataranges []DatarangeInfo `json:"dataranges"`
}

type StartAggregateRequest added in v0.1.3

type StartAggregateRequest struct {
	Datas3tName         string `json:"datas3t_name"`
	FirstDatapointIndex uint64 `json:"first_datapoint_index"`
	LastDatapointIndex  uint64 `json:"last_datapoint_index"`
}

func (*StartAggregateRequest) Validate added in v0.1.3

func (r *StartAggregateRequest) Validate(ctx context.Context) error

type StartAggregateResponse added in v0.1.3

type StartAggregateResponse struct {
	AggregateUploadID int64  `json:"aggregate_upload_id"`
	ObjectKey         string `json:"object_key"`

	// Download URLs for source dataranges
	SourceDatarangeDownloadURLs []DatarangeDownloadURL `json:"source_datarange_download_urls"`

	// Upload URLs for the new aggregate
	UseDirectPut                    bool     `json:"use_direct_put"`
	PresignedMultipartUploadPutURLs []string `json:"presigned_multipart_upload_urls,omitempty"`
	PresignedDataPutURL             string   `json:"presigned_data_put_url,omitempty"`
	PresignedIndexPutURL            string   `json:"presigned_index_put_url"`
}

type UploadDatarangeRequest

type UploadDatarangeRequest struct {
	Datas3tName         string `json:"datas3t_name"`
	DataSize            uint64 `json:"data_size"`
	NumberOfDatapoints  uint64 `json:"number_of_datapoints"`
	FirstDatapointIndex uint64 `json:"first_datapoint_index"`
}

func (*UploadDatarangeRequest) Validate

func (r *UploadDatarangeRequest) Validate(ctx context.Context) error

type UploadDatarangeResponse

type UploadDatarangeResponse struct {
	DatarangeID         int64  `json:"datarange_id"` // Upload record ID (for completion) - actual datarange created on success
	ObjectKey           string `json:"object_key"`
	FirstDatapointIndex uint64 `json:"first_datapoint_index"`

	// Upload type indicator
	UseDirectPut bool `json:"use_direct_put"`

	// For multipart upload (DataSize >= 20MB)
	PresignedMultipartUploadPutURLs []string `json:"presigned_multipart_upload_urls,omitempty"`

	// For direct PUT (DataSize < 5MB)
	PresignedDataPutURL string `json:"presigned_data_put_url,omitempty"`

	// Common fields
	PresignedIndexPutURL string `json:"presigned_index_put_url"`
}

type UploadDatarangeServer

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

func NewServer

func NewServer(db *pgxpool.Pool, encryptionKey string) (*UploadDatarangeServer, error)

func (*UploadDatarangeServer) CancelAggregate added in v0.1.3

func (s *UploadDatarangeServer) CancelAggregate(
	ctx context.Context,
	log *slog.Logger,
	req *CancelAggregateRequest,
) (err error)

func (*UploadDatarangeServer) CancelDatarangeUpload

func (s *UploadDatarangeServer) CancelDatarangeUpload(
	ctx context.Context,
	log *slog.Logger,
	req *CancelUploadRequest,
) (err error)

func (*UploadDatarangeServer) CompleteAggregate added in v0.1.3

func (s *UploadDatarangeServer) CompleteAggregate(ctx context.Context, log *slog.Logger, req *CompleteAggregateRequest) (err error)

func (*UploadDatarangeServer) CompleteDatarangeUpload

func (s *UploadDatarangeServer) CompleteDatarangeUpload(ctx context.Context, log *slog.Logger, req *CompleteUploadRequest) (err error)

func (*UploadDatarangeServer) DeleteDatarange

func (s *UploadDatarangeServer) DeleteDatarange(ctx context.Context, log *slog.Logger, req *DeleteDatarangeRequest) (err error)

func (*UploadDatarangeServer) ListDataranges added in v0.1.5

func (*UploadDatarangeServer) StartAggregate added in v0.1.3

func (*UploadDatarangeServer) StartDatarangeUpload

func (s *UploadDatarangeServer) StartDatarangeUpload(ctx context.Context, log *slog.Logger, req *UploadDatarangeRequest) (_ *UploadDatarangeResponse, err error)

type ValidationError

type ValidationError error

Jump to

Keyboard shortcuts

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