### Install oras-go v2 Package Source: https://github.com/oras-project/oras-go/blob/main/docs/tutorial/quickstart.md Installs the oras-go v2 package and its dependencies using `go get`. ```console $ go get oras.land/oras-go/v2 go: added github.com/opencontainers/go-digest v1.0.0 go: added github.com/opencontainers/image-spec v1.1.0 go: added golang.org/x/sync v0.6.0 go: added oras.land/oras-go/v2 v2.5.0 ``` -------------------------------- ### Graph Functions Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Modeling-Artifacts.md Shows the expected results of Successors(), Predecessors(), and Referrers() functions on graph nodes. ```text Successors(m0) == [b0, b1, b2] Predecessors(m0) == [m2, i0] Referrers(m0) == [m2] Successors(m2) == [m0, b0, b5] Predecessors(m2) == [] Referrers(m2) == [] Successors(b0) == [] Predecessors(b0) == [m0, m2] Referrers(b0) == [] ``` -------------------------------- ### GraphStorage Interface Predecessors Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md Demonstrates the functionality of the Predecessors function for the GraphStorage interface on a sample graph. ```text Predecessors(b0) == [m0] Predecessors(m0) == [] ``` -------------------------------- ### Graph Concepts Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Modeling-Artifacts.md Illustrates a complex DAG integrating artifacts, their referrers, and indexes. ```mermaid graph TD; I0["Index i0"]--manifests-->M0 I0--manifests-->M1 M2["Manifest m2"]--config-->Blob0["Blob b0"] M2--layers-->Blob5["Blob b5"] M2--subject-->M0 M1["Manifest m1"]--config-->Blob3["Blob b3"] M1--layers-->Blob4["Blob b4"] M0["Manifest m0"]--config-->Blob0["Blob b0"] M0--layers-->Blob1["Blob b1"] M0--layers-->Blob2["Blob b2"] ``` -------------------------------- ### Storage Interface Fetch and Exists Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md Illustrates the expected outcomes of Fetch and Exists operations on a Storage interface for a given graph. ```text Fetch(m0) == content_m0 Exists(b0) == true Exists(b3) == false ``` -------------------------------- ### Push Manifest to Repository with Tag Source: https://github.com/oras-project/oras-go/blob/main/docs/tutorial/quickstart.md Packs a manifest with specified layers and artifact type, then pushes it to the repository with the tag "quickstart". Requires the `oras.land/oras-go/v2` package. ```go // 4. Push a manifest to the repository with the tag "quickstart" packOpts := oras.PackManifestOptions{ Layers: []ocispec.Descriptor{layerDescriptor}, } artifactType := "application/vnd.example+type" desc, err := oras.PackManifest(ctx, repo, oras.PackManifestVersion1_1, artifactType, packOpts) if err != nil { panic(err) } tag := "quickstart" err = repo.Tag(ctx, desc, tag) if err != nil { panic(err) } fmt.Println("Pushed and tagged manifest") ``` -------------------------------- ### OCI Image Manifest Descriptor Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md An example of a descriptor for an OCI Image Manifest, including mediaType, size, and digest. ```json { "mediaType": "application/vnd.oci.image.manifest.v1+json", "size": 7682, "digest": "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270" } ``` -------------------------------- ### Manifest Content Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md An example of a manifest content that references blobs for a file and a directory, including their media types, digests, sizes, and annotations. The manifest itself is stored in memory. ```json { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.manifest.v1+json", "artifactType": "application/vnd.example", "config": { "mediaType": "application/vnd.oci.empty.v1+json", "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", "size": 2, "data": "e30=" }, "layers": [ { "mediaType": "application/vnd.custom", "digest": "sha256:5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03", "size": 6, "annotations": { "org.opencontainers.image.title": "hello.txt" } }, { "mediaType": "application/vnd.custom.tar+gzip", "digest": "sha256:b14fa80f5afd3822dce52a711566586c8f89e5dc211e4b0d2819f219b102fe7a", "size": 164, "annotations": { "io.deis.oras.content.digest": "sha256:9d418a0549e5bc45d195aacec889d30e520b9f2bd9feab57d57de6d9cdd66172", "io.deis.oras.content.unpack": "true", "org.opencontainers.image.title": "mydir" } } ], "annotations": { "org.opencontainers.image.created": "2025-03-07T08:34:23Z" } } ``` -------------------------------- ### Target Interface Resolve Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md Shows the results of the Resolve function for a Target interface, including cases where tags exist and do not exist. ```text Resolve("foo") == m0 Resolve("bar") == m0 Resolve("hello") == nil ``` -------------------------------- ### Import ORAS Go v2 Package Source: https://github.com/oras-project/oras-go/blob/main/MIGRATION_GUIDE.md Import the v2 package into your Go project after installation. ```go import "oras.land/oras-go/v2" ``` -------------------------------- ### Copy Function Example: m0 Source: https://github.com/oras-project/oras-go/blob/main/docs/Modeling-Artifacts.md Demonstrates the Copy function replicating the graph rooted by node m0, including m0 and its successors. ```mermaid graph TD; M0["Manifest m0"]--config-->Blob0["Blob b0"] M0--layers-->Blob1["Blob b1"] M0--layers-->Blob2["Blob b2"] ``` -------------------------------- ### File Addition Descriptor Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md Illustrates the descriptor generated when a single file is added to the file store. Includes the media type, digest, size, and an annotation for the original file name. ```json { "mediaType": "application/vnd.custom", "digest": "sha256:5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03", "size": 6, "annotations": { "org.opencontainers.image.title": "hello.txt" } } ``` -------------------------------- ### Copy Function Example: b0 Source: https://github.com/oras-project/oras-go/blob/main/docs/Modeling-Artifacts.md Shows the Copy function replicating only node b0 when it has no successors. ```mermaid graph TD; Blob0["Blob b0"] ``` -------------------------------- ### OCI Index Manifest Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Modeling-Artifacts.md Shows an OCI Index manifest, which is used to group multiple manifests together. Each entry in the 'manifests' array points to a specific artifact manifest. ```json { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.index.v1+json", "manifests": [ { "mediaType": "application/vnd.oci.image.manifest.v1+json", "digest": "sha256:314c7f20dd44ee1cca06af399a67f7c463a9f586830d630802d9e365933da9fb", "size": 762 }, { "mediaType": "application/vnd.oci.image.manifest.v1+json", "digest": "sha256:eba50b7b7dfdf6294a375a3376b2b74e3b926c75119f7da04b1c671c7de662c9", "size": 588 } ] } ``` -------------------------------- ### Get ORAS Go v2 Package Source: https://github.com/oras-project/oras-go/blob/main/MIGRATION_GUIDE.md Use this command to fetch the v2 package of the ORAS Go library. ```sh go get oras.land/oras-go/v2 ``` -------------------------------- ### Directory Addition Descriptor Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md Shows the descriptor for a directory added to the file store, which is tar-archived and compressed. It includes annotations for the original directory name, the digest of the tar'ed content, and a flag indicating it needs unpacking. ```json { "mediaType": "application/vnd.custom.tar+gzip", "digest": "sha256:b14fa80f5afd3822dce52a711566586c8f89e5dc211e4b0d2819f219b102fe7a", "size": 164, "annotations": { "io.deis.oras.content.digest": "sha256:9d418a0549e5bc45d195aacec889d30e520b9f2bd9feab57d57de6d9cdd66172", "io.deis.oras.content.unpack": "true", "org.opencontainers.image.title": "mydir" } } ``` -------------------------------- ### Parse Fetched Manifest and Get Layers Source: https://github.com/oras-project/oras-go/blob/main/docs/tutorial/quickstart.md Parses the fetched manifest content using `encoding/json` and retrieves layer content using `content.FetchAll`. Requires `encoding/json` and `oras.land/oras-go/v2/content` imports. ```go // 6. Parse the fetched manifest content and get the layers var manifest ocispec.Manifest if err := json.Unmarshal(fetchedManifestContent, &manifest); err != nil { panic(err) } for _, layer := range manifest.Layers { layerContent, err := content.FetchAll(ctx, repo, layer) if err != nil { panic(err) } fmt.Println(string(layerContent)) } ``` -------------------------------- ### Content Store Decision Tree Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md A flowchart to guide users in selecting the most appropriate content store based on their requirements. ```mermaid flowchart TD; Q1{"Access remote repository?"} Q1--Y-->Repository["Repository Store"] Q1--N-->Q2{"Reading/writing arbitrary files?"} Q2--Y-->File["File Store"] Q2--N-->Q3{"Need persistent storage?"} Q3--Y-->OCI["OCI Store"] Q3--N-->Memory["Memory Store"] ``` -------------------------------- ### Copy Function Example: m2 Source: https://github.com/oras-project/oras-go/blob/main/docs/Modeling-Artifacts.md Illustrates the Copy function replicating the graph rooted at node m2, including m2, its successor b5, and the subgraph rooted at m0. ```mermaid graph TD; M2["Manifest m2"]--config-->Blob0 M2--layers-->Blob5["Blob b5"] M2--subject-->M0 M0["Manifest m0"]--config-->Blob0["Blob b0"] M0--layers-->Blob1["Blob b1"] M0--layers-->Blob2["Blob b2"] ``` -------------------------------- ### OCI Signature Manifest Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Modeling-Artifacts.md Demonstrates the structure of a signature manifest, which references a signature blob and specifies a 'subject' field pointing to the target artifact manifest. This is used when signing artifacts with tools like 'notation'. ```json { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.manifest.v1+json", "config": { "mediaType": "application/cncf.notary.signature", "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", "size": 2 }, "layers": [ { "mediaType": "application/jose+json", "digest": "sha256:37f88486592fd90ace303ee38f8d1ff698193e76c76d3c1fef8627a39e677696", "size": 2090 } ], "subject": { "mediaType": "application/vnd.oci.image.manifest.v1+json", "digest": "sha256:314c7f20dd44ee1cca06af399a67f7c463a9f586830d630802d9e365933da9fb", "size": 762 }, "annotations": { "io.cncf.notary.x509chain.thumbprint#S256": "[\"a9c85558943f197f41fe7cf3caf691f7df8d0088be426a33d895560717893962\"]", "org.opencontainers.image.created": "2025-02-01T09:50:52Z" } } ``` -------------------------------- ### OCI Image Manifest Example Source: https://github.com/oras-project/oras-go/blob/main/docs/Modeling-Artifacts.md This JSON structure represents an OCI Image Manifest, detailing the artifact's configuration, layers, and annotations. It serves as the root of the artifact's DAG. ```json { "schemaVersion": 2, "mediaType": "application/vnd.oci.image.manifest.v1+json", "artifactType": "application/vnd.example+type", "config": { "mediaType": "application/vnd.oci.empty.v1+json", "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", "size": 2, "data": "e30=" }, "layers": [ { "mediaType": "application/vnd.custom.type", "digest": "sha256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c", "size": 4, "annotations": { "org.opencontainers.image.title": "foo.txt" } }, { "mediaType": "application/vnd.custom.type", "digest": "sha256:7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730", "size": 4, "annotations": { "org.opencontainers.image.title": "bar.txt" } } ], "annotations": { "org.opencontainers.image.created": "2025-01-23T10:57:27Z" } } ``` -------------------------------- ### Create Directory and Initialize Go Module Source: https://github.com/oras-project/oras-go/blob/main/docs/tutorial/quickstart.md Sets up a new directory for your project and initializes a Go module for dependency management. ```shell mkdir oras-go-v2-quickstart cd oras-go-v2-quickstart ``` ```console $ go mod init quickstart/oras-go-v2 go: creating new go.mod: quickstart/oras-go-v2 ``` -------------------------------- ### Connect to Remote Repository with Token Authentication Source: https://github.com/oras-project/oras-go/blob/main/docs/tutorial/quickstart.md Demonstrates connecting to a remote OCI repository using token authentication with username and password. The `retry.DefaultClient` is used for HTTP requests. ```go package main import ( "oras.land/oras-go/v2/registry/remote" "oras.land/oras-go/v2/registry/remote/auth" "oras.land/oras-go/v2/registry/remote/retry" ) func main() { // 1. Connect to a remote repository with token authentication ref := "example.registry.com/myrepo" repo, err := remote.NewRepository(ref) if err != nil { panic(err) } // Note: The below code can be omitted if authentication is not required. repo.Client = &auth.Client{ Client: retry.DefaultClient, Cache: auth.NewCache(), CredentialFunc: credentials.StaticCredentialFunc(repo.Reference.Registry, credentials.Credential{ Username: "username", Password: "password", }), } } ``` -------------------------------- ### Connect to Remote Repository and List Tags Source: https://github.com/oras-project/oras-go/blob/main/docs/tutorial/quickstart.md Connects to a remote OCI registry using token authentication and lists all tags in a specified repository. Ensure the registry URL and credentials are correct. This code can be omitted if authentication is not required. ```go package main import ( "context" "fmt" "os" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "oras.land/oras-go/v2" "oras.land/oras-go/v2/content" "oras.land/oras-go/v2/content/oci" "oras.land/oras-go/v2/registry" "oras.land/oras-go/v2/registry/remote" "oras.land/oras-go/v2/registry/remote/auth" "oras.land/oras-go/v2/registry/remote/retry" ) func main() { // 1. Connect to a remote repository with token authentication ref := "example.registry.com/myrepo" repo, err := remote.NewRepository(ref) if err != nil { panic(err) } // Note: The below code can be omitted if authentication is not required. repo.Client = &auth.Client{ Client: retry.DefaultClient, Cache: auth.NewCache(), CredentialFunc: credentials.StaticCredentialFunc(repo.Reference.Registry, credentials.Credential{ Username: "username", Password: "password", }), } // 2. Show the tags in the repository ctx := context.Background() err = repo.Tags(ctx, "", func(tags []string) error { for _, tag := range tags { fmt.Println(tag) } return nil }) if err != nil { panic(err) } // 3. push a layer to the repository layer := []byte("example manifest layer") layerDescriptor, err := oras.PushBytes(ctx, repo, ocispec.MediaTypeImageLayer, layer) if err != nil { panic(err) } fmt.Println("Pushed manifest layer:", layerDescriptor.Digest) // 4. Push a manifest to the repository with the tag "quickstart" packOpts := oras.PackManifestOptions{ Layers: []ocispec.Descriptor{layerDescriptor}, } artifactType := "application/vnd.example+type" desc, err := oras.PackManifest(ctx, repo, oras.PackManifestVersion1_1, artifactType, packOpts) if err != nil { panic(err) } tag := "quickstart" err = repo.Tag(ctx, desc, tag) if err != nil { panic(err) } fmt.Println("Pushed and tagged manifest") // 5. Fetch the manifest from the repository by tag _, fetchedManifestContent, err := oras.FetchBytes(ctx, repo, tag, oras.DefaultFetchBytesOptions) if err != nil { panic(err) } fmt.Println(string(fetchedManifestContent)) // 6. Parse the fetched manifest content and get the layers var manifest ocispec.Manifest if err := json.Unmarshal(fetchedManifestContent, &manifest); err != nil { panic(err) } for _, layer := range manifest.Layers { layerContent, err := content.FetchAll(ctx, repo, layer) if err != nil { panic(err) } fmt.Println(string(layerContent)) } // 7. Copy the artifact to local OCI layout directory with a tag "quickstartOCI" ociDir, err := os.MkdirTemp(".", "oras_oci_example_*") if err != nil { panic(err) } ociTarget, err := oci.New(ociDir) if err != nil { panic(err) } _, err = oras.Copy(ctx, repo, tag, ociTarget, "quickstartOCI", oras.DefaultCopyOptions) if err != nil { panic(err) } fmt.Println("Copied the artifact") } ``` -------------------------------- ### List Repository Tags Source: https://github.com/oras-project/oras-go/blob/main/docs/tutorial/quickstart.md Uses the `Tags` method to list all tags in a remote repository. Ensure `context` and `fmt` are imported. ```go // 2. Show the tags in the repository ctx := context.Background() err = repo.Tags(ctx, "", func(tags []string) error { for _, tag := range tags { fmt.Println(tag) } return nil }) if err != nil { panic(err) } ``` -------------------------------- ### Run Go Program Source: https://github.com/oras-project/oras-go/blob/main/docs/tutorial/quickstart.md Executes the Go program using `go run .`. ```shell go run . ``` -------------------------------- ### Fetch Manifest from Repository by Tag Source: https://github.com/oras-project/oras-go/blob/main/docs/tutorial/quickstart.md Fetches the content of a manifest from the repository using its tag. Uses `oras.FetchBytes` and requires the `oras.land/oras-go/v2` package. ```go // 5. Fetch the manifest from the repository by tag _, fetchedManifestContent, err := oras.FetchBytes(ctx, repo, tag, oras.DefaultFetchBytesOptions) if err != nil { panic(err) } fmt.Println(string(fetchedManifestContent)) ``` -------------------------------- ### OCI Store File System Layout Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md Illustrates the directory structure for an artifact and its signature stored using the OCI store, adhering to the OCI Image Layout specification. ```bash repo/ ├── blobs │   └── sha256 │   ├── 314c7f20dd44ee1cca06af399a67f7c463a9f586830d630802d9e365933da9fb │   ├── 37f88486592fd90ace303ee38f8d1ff698193e76c76d3c1fef8627a39e677696 │   ├── 44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a │   ├── 7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730 │   ├── b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c │   └── e5727bebbcbbd9996446c34622ca96af67a54219edd58d261112f1af06e2537c ├── index.json ├── ingest └── oci-layout ``` -------------------------------- ### Tidy Go Modules Source: https://github.com/oras-project/oras-go/blob/main/MIGRATION_GUIDE.md Run this command to update your Go module dependencies after adding the v2 package. ```sh go mod tidy ``` -------------------------------- ### Repository Store API Mappings Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md Mappings of Repository Store functions to their corresponding OCI distribution-spec API endpoints for manifests and blobs. ```markdown | Function Name | API endpoint | | -------------- | -------------------------------------------------------------------------------------------------------------------- | | `Fetch` | GET `/v2//manifests/` | | `Exists` | HEAD `/v2//manifests/` | | `Push` | PUT `/v2//manifests/` | | `Resolve` | HEAD `/v2//manifests/` | | `Tag` | PUT `/v2//manifests/` | | `Predecessors` | GET `/v2//referrers/?artifactType=`
Fallback to `Referrers Tag Schema` if unavailable | | Function Name | API endpoint | | ------------- | ---------------------------------------------------------------------------------------------- | | `Fetch` | GET `/v2//blobs/` | | `Exists` | HEAD `/v2//blobs/` | | `Push` | POST `/v2//blobs/uploads/`
PUT `/v2//blobs/uploads/?digest=` | | `Resolve` | HEAD `/v2//blobs/` | ``` -------------------------------- ### Push Manifest Layer Source: https://github.com/oras-project/oras-go/blob/main/docs/tutorial/quickstart.md Pushes a manifest layer to the remote repository using `oras.PushBytes`. Requires `ocispec` and `oras` packages to be imported. ```go // 3. push a layer to the repository layer := []byte("example manifest layer") layerDescriptor, err := oras.PushBytes(ctx, repo, ocispec.MediaTypeImageLayer, layer) if err != nil { panic(err) } fmt.Println("Pushed manifest layer:", layerDescriptor.Digest) ``` -------------------------------- ### Copy Artifact to Local OCI Layout Directory Source: https://github.com/oras-project/oras-go/blob/main/docs/tutorial/quickstart.md Copies an artifact from the repository by its tag and saves it to a temporary local directory in OCI layout format using `oras.Copy`. Requires `os` and `oras.land/oras-go/v2/content/oci` imports. ```go // 7. Copy the artifact to local OCI layout directory with a tag "quickstartOCI" ociDir, err := os.MkdirTemp(".", "oras_oci_example_*") if err != nil { panic(err) } ociTarget, err := oci.New(ociDir) if err != nil { panic(err) } _, err = oras.Copy(ctx, repo, tag, ociTarget, "quickstartOCI", oras.DefaultCopyOptions) if err != nil { panic(err) } fmt.Println("Copied the artifact") ``` -------------------------------- ### Manifest Store Mappings Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md Mappings between Manifest Store functions and their corresponding registry API endpoints. ```APIDOC ## Manifest Store Operations ### Fetch - **Method**: GET - **Endpoint**: `/v2//manifests/` ### Exists - **Method**: HEAD - **Endpoint**: `/v2//manifests/` ### Push - **Method**: PUT - **Endpoint**: `/v2//manifests/` ### Resolve - **Method**: HEAD - **Endpoint**: `/v2//manifests/` ### Tag - **Method**: PUT - **Endpoint**: `/v2//manifests/` ### Predecessors - **Description**: Retrieves predecessors using the Referrers API or Fallback to Referrers Tag Schema. - **Method**: GET - **Endpoint**: `/v2//referrers/?artifactType=` ``` -------------------------------- ### Blob Store Mappings Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md Mappings between Blob Store functions and their corresponding registry API endpoints. ```APIDOC ## Blob Store Operations ### Fetch - **Method**: GET - **Endpoint**: `/v2//blobs/` ### Exists - **Method**: HEAD - **Endpoint**: `/v2//blobs/` ### Push - **Description**: Initiates blob upload and completes it. - **Method**: POST - **Endpoint**: `/v2//blobs/uploads/` - **Method**: PUT - **Endpoint**: `/v2//blobs/uploads/?digest=` ### Resolve - **Method**: HEAD - **Endpoint**: `/v2//blobs/` ``` -------------------------------- ### GraphStorage Interface Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md The GraphStorage interface extends Storage by adding support for predecessor finding, enabling navigation within the graph structure. ```APIDOC ## GraphStorage Interface ### Description Extends the Storage interface by adding support for predecessor finding. ### Functions - `Fetch(descriptor)`: Retrieves the content identified by the descriptor from the CAS. - `Exists(descriptor)`: Checks whether the described content is present in the CAS. - `Push(descriptor, content)`: Adds content matching the expected descriptor to the CAS. - `Predecessors(descriptor)`: Finds the nodes directly pointing to a given node in the graph. ``` -------------------------------- ### Storage Interface Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md The Storage interface represents a content-addressable storage (CAS) where content is accessed via descriptors. It provides functions to Fetch, check existence with Exists, and add content with Push. ```APIDOC ## Storage Interface ### Description Represents a content-addressable storage (CAS) where content is accessed via descriptors. ### Functions - `Fetch(descriptor)`: Retrieves the content identified by the descriptor from the CAS. - `Exists(descriptor)`: Checks whether the described content is present in the CAS. - `Push(descriptor, content)`: Adds content matching the expected descriptor to the CAS. ``` -------------------------------- ### GraphTarget Interface Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md The GraphTarget interface combines the capabilities of GraphStorage and Target, offering full graph traversal and tagging functionality. ```APIDOC ## GraphTarget Interface ### Description Combines the capabilities of GraphStorage and Target. ### Functions - `Fetch(descriptor)`: Retrieves the content identified by the descriptor from the CAS. - `Exists(descriptor)`: Checks whether the described content is present in the CAS. - `Push(descriptor, content)`: Adds content matching the expected descriptor to the CAS. - `Resolve(tag)`: Resolves a tag string to a descriptor. - `Tag(descriptor, tag)`: Associates a descriptor with a tag string. - `Predecessors(descriptor)`: Finds the nodes directly pointing to a given node in the graph. ``` -------------------------------- ### Target Interface Source: https://github.com/oras-project/oras-go/blob/main/docs/Targets.md The Target interface represents a CAS with tagging capability, allowing descriptors to be associated with human-readable tags. ```APIDOC ## Target Interface ### Description Represents a CAS with tagging capability. ### Functions - `Fetch(descriptor)`: Retrieves the content identified by the descriptor from the CAS. - `Exists(descriptor)`: Checks whether the described content is present in the CAS. - `Push(descriptor, content)`: Adds content matching the expected descriptor to the CAS. - `Resolve(tag)`: Resolves a tag string to a descriptor. - `Tag(descriptor, tag)`: Associates a descriptor with a tag string. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.