layout

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package layout defines media object keys, dependency-free so the access worker can classify paths without importing the media runtime:

{tenant}/{kind}/{content_id}/manifest.json | manifests/{version}.json
                            /originals/{sha256-hex | u-uuid | slot | slot.json | i-uuid}
                            /blobs/{sha256-hex | u-uuid}
                            /public/{name}.webp

Index

Constants

View Source
const (
	AreaManifest  = "manifest" // manifest.json and manifests/{version}.json
	AreaOriginals = "originals"
	AreaBlobs     = "blobs"
	AreaPublic    = "public"
)

Folder areas.

View Source
const (
	SHA256Prefix = "sha256-"
	UploadPrefix = "u-"
	InlinePrefix = "i-"
	PublicExt    = ".webp"
	// VersionParam versions a public URL: served immutable while it matches
	// the object's VersionMeta.
	VersionParam = "v"
	VersionMeta  = "of"
)

Variables

This section is empty.

Functions

func ParseSHA256Name

func ParseSHA256Name(name string) ([]byte, bool)

ParseSHA256Name returns the digest of a "sha256-{hex}" name.

func ValidBlobName

func ValidBlobName(name string) bool

ValidBlobName accepts "sha256-{64 lowercase hex}" and "u-{uuid}".

func ValidInlineName added in v0.17.0

func ValidInlineName(name string) bool

ValidInlineName accepts "i-{uuid}", an inline image's id.

func ValidSegment

func ValidSegment(s string) bool

ValidSegment keeps keys stable ASCII: [A-Za-z0-9._-]{1,128}, no leading dot.

Types

type Key

type Key struct {
	Tenant, Kind, ID string
	Area             string // AreaManifest, AreaOriginals, AreaBlobs or AreaPublic
	Name             string // file name within the area; the version id for manifests/
}

Key is a parsed object key.

func Parse

func Parse(key string) (Key, bool)

Parse classifies an object key; ok is false for anything outside the layout, including keys nested deeper than it allows.

Jump to

Keyboard shortcuts

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