Documentation
¶
Overview ¶
Package bundlesecret is the format of the operator's bundle Secret, which the operator writes and the engines and inkwallctl read (0004 §4.6).
A bundle that fits in one Secret is stored there, gzip-compressed, under BundleKey. A larger one is split into chunk Secrets, and the bundle Secret holds a Manifest under ManifestKey instead. Chunks are written to one of two sets of names, the one the current manifest doesn't use, before the manifest: a reader never sees a manifest whose chunks are not all written, and the hash in the manifest rejects chunks overwritten since.
Index ¶
Constants ¶
const ( // BundleKey holds the gzip-compressed, serialized SignedBundle, when it // fits in one Secret. BundleKey = "bundle.pb.gz" // ManifestKey holds the Manifest of a bundle split into chunks. ManifestKey = "manifest.json" // ChunkKey holds a chunk Secret's part of the compressed bundle. ChunkKey = "chunk" )
Keys of the bundle Secret and its chunks.
const ( // ChunkBytes is the most of the compressed bundle one Secret holds: // Secrets are limited to 1 MiB. ChunkBytes = 900 << 10 // MaxChunks bounds the chunks of one bundle. MaxChunks = 8 // MaxBytes is the largest compressed bundle. MaxBytes = MaxChunks * ChunkBytes // MaxBundleBytes is the largest bundle decompressed. MaxBundleBytes = 64 << 20 )
Limits of the format.
Variables ¶
var ErrIncomplete = errors.New("bundle chunks incomplete")
ErrIncomplete is returned when the chunks don't match their manifest: one is missing, or was overwritten by a newer bundle being written.
Functions ¶
func ChunkNames ¶
ChunkNames returns every name a chunk of secret can have: what engines need get on, besides the bundle Secret.
Types ¶
type Manifest ¶
type Manifest struct {
// SHA256 is the hash of the whole compressed bundle, in hex.
SHA256 string `json:"sha256"`
// Size is its length in bytes.
Size int `json:"size"`
// Chunks are the names of the chunk Secrets, in order, in the bundle
// Secret's namespace.
Chunks []string `json:"chunks"`
}
Manifest lists the chunks of a bundle.
func ParseManifest ¶
ParseManifest reads the manifest of secret, and checks that its chunks are named as Split names them.
func Split ¶
Split splits a compressed bundle into chunks named in slot, and returns their manifest.