dataranges

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 5MB minimum part size for S3 multipart upload
	MinPartSize = 5 * 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")

Functions

This section is empty.

Types

type CancelUploadRequest

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

type CompleteUploadRequest

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

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 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 >= 5MB)
	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) CancelDatarangeUpload

func (s *UploadDatarangeServer) CancelDatarangeUpload(
	ctx context.Context,
	log *slog.Logger,
	req *CancelUploadRequest,
) (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) 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