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 the item's one manifest; never served
/originals/sha256-{hex} uploads; never served
/temp/u-{uuid} staged multipart uploads until placed; never served
/temp/e-{hex} editor views; editor token only
/private/sha256-{hex} every rendition; token-gated
/public/sha256-{hex} copies of the exposed renditions; anyone
originals/, private/ and public/ names are the SHA-256 of the object, so objects are immutable: a change writes a new name. temp/ is discardable: nothing a viewer needs lives there, and the sweep wipes it by age.
Index ¶
- Constants
- func ParseSHA256Name(name string) ([]byte, bool)
- func SourceArea(name string) string
- func ValidEditorName(name string) bool
- func ValidHashName(name string) bool
- func ValidInlineName(name string) bool
- func ValidSegment(s string) bool
- func ValidSourceName(name string) bool
- func ValidStagedName(name string) bool
- type Key
Constants ¶
const ( AreaManifest = "manifest" AreaOriginals = "originals" AreaTemp = "temp" AreaPrivate = "private" AreaPublic = "public" )
Folder areas.
const ( SHA256Prefix = "sha256-" UploadPrefix = "u-" InlinePrefix = "i-" EditorPrefix = "e-" )
const ManifestName = "manifest.json"
ManifestName is the manifest's key within the folder.
Variables ¶
This section is empty.
Functions ¶
func ParseSHA256Name ¶
ParseSHA256Name returns the digest of a "sha256-{hex}" name.
func SourceArea ¶ added in v0.40.0
SourceArea is where an uploaded file named name lives: temp/ for a "u-{uuid}" not yet placed, originals/ for a "sha256-{hex}".
func ValidEditorName ¶ added in v0.52.0
ValidEditorName accepts "e-{64 lowercase hex}", an editor view.
func ValidHashName ¶ added in v0.48.0
ValidHashName accepts "sha256-{64 lowercase hex}".
func ValidInlineName ¶ added in v0.17.0
ValidInlineName accepts "i-{uuid}", an inline image's id.
func ValidSegment ¶
ValidSegment keeps keys stable ASCII: [A-Za-z0-9._-]{1,128}, no leading dot.
func ValidSourceName ¶ added in v0.48.0
ValidSourceName accepts an uploaded file's name: a hash, or "u-{uuid}" until the worker places it.
func ValidStagedName ¶ added in v0.40.0
ValidStagedName accepts "u-{uuid}", an upload whose hash is not yet known.