storage

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package storage defines the storage identity shared by Snapshot and PageBroker. It does not access a store or select a transfer engine.

Index

Constants

View Source
const PVCRoot = "/"

PVCRoot is the base path inside the claim currently used by Snapshot. It is independent of the container-local /checkpoints mount point.

Variables

This section is empty.

Functions

func ValidateArtifactIdentity

func ValidateArtifactIdentity(storeID, artifactUID, containerName string) error

ValidateArtifactIdentity checks the three fields that name one container publication: the bound store ID, the owning PodSnapshotContent UID (not its reusable name or an RPC transaction ID) and the container name.

Types

type Config

type Config struct {
	PVC *PVC `json:"pvc,omitempty" yaml:"pvc,omitempty"`
	S3  *S3  `json:"s3,omitempty" yaml:"s3,omitempty"`
}

Config is the resolved storage configuration the chart renders into storage.yaml for the operator. Exactly one backend block is populated and selects the backend; Helm's storage.type only chooses which block to render. PageBroker does not consume this file for the S3 backend: it reads its own resolved config, written separately with the computed store ID.

type PVC

type PVC struct {
	Namespace string `json:"namespace" yaml:"namespace"`
	ClaimName string `json:"claimName" yaml:"claimName"`
	BasePath  string `json:"basePath" yaml:"basePath"`
}

PVC identifies a logical store inside a namespaced PVC. BasePath is absolute within the claim, not the mount path in a consuming container. A claim name identifies a configured location, not a particular PVC/PV incarnation.

func (PVC) NormalizedBasePath

func (p PVC) NormalizedBasePath() (string, error)

NormalizedBasePath cleans redundant separators and dot components, but rejects traversal instead of silently identifying a different store. An empty path is not an implicit root; configuration must state which location it identifies.

func (PVC) StoreID

func (p PVC) StoreID() (string, error)

StoreID hashes the canonical PVC location. No filesystem or Kubernetes lookup is performed; credentials, node names and container mount paths are not inputs. The exact v1 preimage is five length-prefixed UTF-8 fields, in order: "snapshot.store/v1", "pvc", namespace, claimName, normalizedBasePath. Each length is an unsigned 32-bit big-endian byte count (no terminator). Shared vectors in testdata/identity.json pin this encoding for other languages.

type S3

type S3 struct {
	Endpoint string `json:"endpoint" yaml:"endpoint"`
	Region   string `json:"region" yaml:"region"`
	Bucket   string `json:"bucket" yaml:"bucket"`
	Prefix   string `json:"prefix,omitempty" yaml:"prefix,omitempty"`
}

S3 identifies a logical store inside an S3-compatible bucket. Prefix is a relative key prefix inside the bucket, not an absolute filesystem path. Credentials, part sizes and transfer limits are not identity inputs: they can change without moving the store to a new identity.

func (S3) NormalizedEndpoint

func (s S3) NormalizedEndpoint() (string, error)

NormalizedEndpoint validates the endpoint as an absolute http(s) URL and lowercases its scheme and host, so differently-cased but equivalent endpoints resolve to the same store identity. The path, query and fragment are rejected: the endpoint identifies a service, not a location in it. A scheme's default port is dropped so an explicit ":443"/":80" hashes the same as its implicit form.

func (S3) NormalizedPrefix

func (s S3) NormalizedPrefix() (string, error)

NormalizedPrefix cleans redundant separators and dot components inside a relative bucket-key prefix, but rejects traversal and absolute paths instead of silently identifying a different location. An empty prefix identifies the bucket root.

func (S3) StoreID

func (s S3) StoreID() (string, error)

StoreID hashes the canonical S3 location. No network request is performed; credentials, addressing mode and transfer limits are not inputs. The exact v1 preimage is six length-prefixed UTF-8 fields, in order: "snapshot.store/v1", "s3", normalizedEndpoint, region, bucket, normalizedPrefix. Each length is an unsigned 32-bit big-endian byte count (no terminator). Shared vectors in testdata/identity.json pin this encoding for other languages.

Directories

Path Synopsis
Package coordination is the shared contract maintenance backends and checkpoint/restore callers enforce before mutating a published artifact.
Package coordination is the shared contract maintenance backends and checkpoint/restore callers enforce before mutating a published artifact.

Jump to

Keyboard shortcuts

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