common

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  int64 = 1
	KB int64 = 1024 * B
	MB int64 = 1024 * KB
	GB int64 = 1024 * MB
	TB int64 = 1024 * GB

	DataAccessTokenEndpoint = "/user/credentials/api/access_token"
	DataTimeout             = 5 * time.Minute
	HeaderContentType       = "Content-Type"
	MIMEApplicationJSON     = "application/json"
	FileSizeLimit           = 5 * GB
	MaxRetryCount           = 5
	MaxWaitTime             = 300
	MaxConcurrentUploads    = 10
	OnProgressThreshold     = 1 * MB
	HealthzEndpoint         = "/healthz"
)

Variables

This section is empty.

Functions

func FormatSize added in v0.3.6

func FormatSize(size int64) string

func GetOid

func GetOid(ctx context.Context) string

func IsCloudPresignedURL

func IsCloudPresignedURL(raw string) bool

func ResponseBodyError

func ResponseBodyError(resp *http.Response, prefix string) error

func WithOid

func WithOid(ctx context.Context, oid string) context.Context

func WithProgress

func WithProgress(ctx context.Context, cb ProgressCallback) context.Context

Types

type FileMetadata

type FileMetadata struct {
	Authorizations map[string][]string `json:"authorizations,omitempty"`
	Aliases        []string            `json:"aliases"`
	Metadata       map[string]any      `json:"metadata"`
}

type ProgressCallback

type ProgressCallback func(ProgressEvent) error

func GetProgress

func GetProgress(ctx context.Context) ProgressCallback

type ProgressEvent

type ProgressEvent struct {
	Event          string         `json:"event"`
	Oid            string         `json:"oid"`
	BytesSoFar     int64          `json:"bytesSoFar"`
	BytesSinceLast int64          `json:"bytesSinceLast"`
	Message        string         `json:"message,omitempty"`
	Level          string         `json:"level,omitempty"`
	Attrs          map[string]any `json:"attrs,omitempty"`
}

Jump to

Keyboard shortcuts

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