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 ¶
- func NewAzureOrigin(client *service.Client, config OriginConfig) (racersdk.Origin, error)
- func NewOrigin(client S3Client, config OriginConfig) (racersdk.Origin, error)
- func NewRequest(bucket, key, versionID string) (racersdk.Request, error)
- func NewSidecar(client *racersdk.Client, config SidecarConfig) (http.Handler, error)
- func ParseAzureContainerURL(value, credential string) (accountURL, container string, err error)
- func ValidAzureContainerName(name string) bool
- func ValidateAzureAccountURL(value, credential string) error
- func ValidateBucket(bucket string) error
- type Object
- type OriginConfig
- type S3Client
- type SidecarConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAzureOrigin ¶
NewAzureOrigin reads block blobs without caching. Schema-1 Bucket names the container, which must equal config.Bucket. Use a separate cache for each provider, account, and container.
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 ¶
NewRequest hashes canonical schema-1 JSON and carries it as origin metadata. Keys and version IDs are never cleaned, decoded, or normalized.
func NewSidecar ¶
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.
func ParseAzureContainerURL ¶ added in v0.17.0
ParseAzureContainerURL splits an Azure Blob container URL into the account URL and the container name. The last path segment is the container; what precedes it must be a valid account URL (see ValidateAzureAccountURL), so Azurite-style URLs such as http://127.0.0.1:10000/account/container work. credential is "default" or "anonymous"; the default credential requires HTTPS.
func ValidAzureContainerName ¶ added in v0.17.0
ValidAzureContainerName reports whether name follows the Azure Blob container naming rules: 3 to 63 lowercase letters, digits, and single hyphens, starting and ending with a letter or digit.
func ValidateAzureAccountURL ¶ added in v0.17.0
ValidateAzureAccountURL checks an Azure Blob account URL for the origin. credential is "default" or "anonymous"; the default credential requires HTTPS. Azurite-style URLs may carry one simple account path segment.
func ValidateBucket ¶ added in v0.17.0
ValidateBucket reports whether an origin accepts bucket, so callers that render origin flags can reject it before the origin starts.
Types ¶
type Object ¶
type Object struct {
Schema int `json:"schema"`
Bucket string `json:"bucket"`
Key string `json:"key"`
VersionID string `json:"versionId,omitempty"`
}
Object identifies an exact upstream object in the origin's bucket.
type OriginConfig ¶
type OriginConfig struct {
Bucket string
// MetadataTTL is an admission hint. Zero expires metadata immediately.
MetadataTTL time.Duration
}
OriginConfig binds requests to one upstream bucket.
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 {
// API selects s3 (the default) or azure. Buckets name Azure containers.
API string
}
SidecarConfig selects the sidecar API. The sidecar forwards every bucket; the origin enforces its single configured bucket.