blob

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SignedURLMarkerParam = "sp_file"
	SignedURLMarkerValue = "1"
)
View Source
const (
	ScopeApp          = "app"
	ScopeOrganization = "organization"
	ScopeWorkspace    = "workspace"
	ScopeTask         = "task"
)
View Source
const (
	ProviderGCS        = "gcs"
	ProviderS3         = "s3"
	ProviderAzure      = "azure"
	ProviderFilesystem = "filesystem"
)
View Source
const FileRefScheme = "sp-file"
View Source
const (
	UIDownloadTTL = time.Hour
)

Variables

View Source
var (
	ErrNotFound              = errors.New("blob not found")
	ErrSignedURLUnsupported  = errors.New("blob provider cannot mint object signed URLs")
	ErrProviderNotConfigured = errors.New("blob storage provider is not configured")
)

Functions

func DispatchDownloadTTL

func DispatchDownloadTTL(executionTimeoutSeconds int) time.Duration

func FileAccessURL

func FileAccessURL(fileID uuid.UUID, ttl time.Duration, key []byte) (string, error)

func FileIDFromSignedURL

func FileIDFromSignedURL(raw string) (uuid.UUID, bool)

func FileIDsInMarkdown

func FileIDsInMarkdown(markdown string) []uuid.UUID

func FileRef

func FileRef(id uuid.UUID) string

func HTTPImageURLs

func HTTPImageURLs(markdown string) []string

func HTTPResourceURLs

func HTTPResourceURLs(markdown string) []string

HTTPResourceURLs returns http and https targets from markdown links, image tags, and anchor tags. Image-only callers use HTTPImageURLs.

func IsGitHubImageHost

func IsGitHubImageHost(host string) bool

func IsGitHubImageURL

func IsGitHubImageURL(raw string) bool

func MarkdownLinkLabel

func MarkdownLinkLabel(name string) string

func ObjectKey

func ObjectKey(installationID, scope string, organizationID, factoryID, workOrderID, fileID uuid.UUID) (string, error)

func ParseFileID

func ParseFileID(raw string) (uuid.UUID, bool)

func PublicBaseURL

func PublicBaseURL() string

func ReplaceURL

func ReplaceURL(markdown, from, to string) string

func ResolveDownloadURL

func ResolveDownloadURL(ctx context.Context, provider Provider, storageKey string, fileID uuid.UUID, ttl time.Duration) (string, error)

func RewriteFileRefs

func RewriteFileRefs(markdown string, urls map[uuid.UUID]string) string

func RewriteSignedFileURLs

func RewriteSignedFileURLs(markdown string, replace func(uuid.UUID) (string, bool)) string

func SetCurrent

func SetCurrent(provider Provider)

func SignFileAccess

func SignFileAccess(fileID uuid.UUID, expires int64, key []byte) (string, error)

func SignedFileURLs

func SignedFileURLs(text string) []string

func SigningKey

func SigningKey() ([]byte, error)

func StableExpiry

func StableExpiry(ttl time.Duration) time.Time

StableExpiry rounds the signed-URL end time up to a bucket so remints in the same window return the same URL. That keeps <img> src stable while a chat poll refreshes the work order.

func VerifyFileAccess

func VerifyFileAccess(fileID uuid.UUID, expires int64, sig string, key []byte) error

Types

type ObjectInfo

type ObjectInfo struct {
	Size            int64
	ContentType     string
	ContentEncoding string
}

type Provider

type Provider interface {
	Name() string
	Put(ctx context.Context, key string, r io.Reader, opts PutOptions) error
	Get(ctx context.Context, key string) (io.ReadCloser, error)
	GetRange(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)
	Head(ctx context.Context, key string) (*ObjectInfo, error)
	Delete(ctx context.Context, key string) error
	// SignedGetURL returns a time-limited HTTPS GET for the object.
	// Filesystem returns ErrSignedURLUnsupported; callers mint an HMAC file URL.
	SignedGetURL(ctx context.Context, key string, ttl time.Duration) (string, error)
}

Provider stores opaque object bytes. Catalog metadata lives in Postgres.

func Current

func Current() Provider

type PutOptions

type PutOptions struct {
	ContentType     string
	ContentEncoding string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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