-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoc.go
More file actions
53 lines (53 loc) · 1.62 KB
/
Copy pathdoc.go
File metadata and controls
53 lines (53 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Package blob provides a file archive format optimized for random access
// via HTTP range requests against OCI registries.
//
// This package provides a unified high-level API through [Client] for pushing
// and pulling blob archives to/from OCI registries. For low-level archive
// operations without registry interaction, use the [core] subpackage.
//
// Archives consist of two OCI blobs:
// - Index blob: FlatBuffers-encoded file metadata enabling O(log n) lookups
// - Data blob: Concatenated file contents, sorted by path for efficient directory fetches
//
// # Quick Start
//
// Push a directory to a registry:
//
// c, err := blob.NewClient(blob.WithDockerConfig())
// if err != nil {
// return err
// }
// err = c.Push(ctx, "ghcr.io/myorg/myarchive:v1", "./src",
// blob.PushWithCompression(blob.CompressionZstd),
// )
//
// Pull and read files:
//
// archive, err := c.Pull(ctx, "ghcr.io/myorg/myarchive:v1")
// if err != nil {
// return err
// }
// content, err := archive.ReadFile("config.json")
//
// # Caching
//
// Use WithCacheDir for automatic caching of all blob metadata and content:
//
// c, err := blob.NewClient(
// blob.WithDockerConfig(),
// blob.WithCacheDir("/var/cache/blob"),
// )
//
// For fine-grained control, use individual cache options like
// [WithRefCacheDir], [WithManifestCacheDir], [WithContentCacheDir], etc.
//
// # Policies
//
// Add verification policies to enforce security requirements on pull:
//
// sigPolicy, _ := sigstore.NewPolicy(sigstore.WithIdentity(issuer, subject))
// c, err := blob.NewClient(
// blob.WithDockerConfig(),
// blob.WithPolicy(sigPolicy),
// )
package blob