racerobject

package
v0.16.0 Latest Latest
Warning

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

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

Documentation

Overview

Package racerobject adapts S3 objects to racersdk: an Origin that reads exact object versions from S3 and a sidecar HTTP handler that serves them to pods through a racersdk client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAzureOrigin

func NewAzureOrigin(client *service.Client, config OriginConfig) (racersdk.Origin, error)

NewAzureOrigin reads block blobs without caching. Schema-1 Bucket names the container. Use a separate namespace and cache for each provider and account.

func NewOrigin

func NewOrigin(client S3Client, config OriginConfig) (racersdk.Origin, error)

NewOrigin serves full metadata and conditional page reads without caching. The client must return bodies whose Close interrupts Read, as the AWS client does.

func NewRequest

func NewRequest(namespace, bucket, key, versionID string) (racersdk.Request, error)

NewRequest hashes canonical schema-1 JSON and carries it as origin metadata. Keys and version IDs are never cleaned, decoded, or normalized.

func NewSidecar

func NewSidecar(client *racersdk.Client, config SidecarConfig) (http.Handler, error)

NewSidecar serves a read-only, trusted pod endpoint. The caller owns the client and must bind the server to loopback. Authorization is ignored, not verified or forwarded. Signed query parameters and unsupported operations are rejected. Only known auth/plumbing provider headers and supported read headers are accepted. Install this handler directly: a path-cleaning mux changes object identities.

Types

type Object

type Object struct {
	Schema    int    `json:"schema"`
	Namespace string `json:"namespace"`
	Bucket    string `json:"bucket"`
	Key       string `json:"key"`
	VersionID string `json:"versionId,omitempty"`
}

Object identifies an exact upstream object within a configured namespace.

type OriginConfig

type OriginConfig struct {
	Namespace string
	Buckets   []string
	// MetadataTTL is an admission hint. Zero expires metadata immediately.
	MetadataTTL time.Duration
}

OriginConfig binds requests to one upstream namespace and optional buckets.

type S3Client

type S3Client interface {
	HeadObject(context.Context, *s3.HeadObjectInput, ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
	GetObject(context.Context, *s3.GetObjectInput, ...func(*s3.Options)) (*s3.GetObjectOutput, error)
}

S3Client is the read-only subset of the AWS v2 S3 client used by the origin.

type SidecarConfig

type SidecarConfig struct {
	Namespace string
	Buckets   []string
	// API selects s3 (the default) or azure. Buckets names Azure containers.
	API string
}

SidecarConfig selects the object namespace and optional bucket allowlist.

Jump to

Keyboard shortcuts

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