diff --git a/attributes/doc.go b/attributes/doc.go index 0bf9e83a..4c9a2c3e 100644 --- a/attributes/doc.go +++ b/attributes/doc.go @@ -18,3 +18,6 @@ package attributes // This package contains helper functions when creating new attributes. // WARNING: The helper functions (attribute.Reflect) in this package use reflection and therefore will incur a performance penalty. + +// Similar implementation to the go-ipld-prime library. +// Reference: https://github.com/ipld/go-ipld-prime/tree/master/node/basicnode diff --git a/model/traversal/budget.go b/model/traversal/budget.go index af8f3b6f..cf021b9e 100644 --- a/model/traversal/budget.go +++ b/model/traversal/budget.go @@ -6,6 +6,9 @@ import ( "github.com/emporous/emporous-go/model" ) +// Similar to the budget in the go-ipld-prime library. +// Reference: https://github.com/ipld/go-ipld-prime/blob/ab0f17bec1e700e4c76a6bbc28e7260cea7c035d/traversal/fns.go#L114 + // Budget tracks budgeted operations during graph traversal. type Budget struct { // Maximum numbers of nodes to visit in a single traversal operator before stopping. diff --git a/nodes/collection/collection.go b/nodes/collection/collection.go index c07d4493..88b62aa7 100644 --- a/nodes/collection/collection.go +++ b/nodes/collection/collection.go @@ -14,6 +14,11 @@ var ( _ model.Iterator = &Collection{} ) +// Adapted from gonum/graph/simple/directed.go. +// Reference: https://github.com/gonum/gonum/blob/e8ed540b8ee27ad9adf717046542d9ed24eb9215/graph/simple/directed.go#L36 +// Copyright ©2013 The Gonum Authors. All rights reserved. +// Use of this source code is governed by a BSD-style + // Collection is implementation of a model Node represent one OCI artifact // stored in memory. // WARNING: Collection type is not thread-safe. diff --git a/nodes/collection/iterator.go b/nodes/collection/iterator.go index 37d44f4c..597e89c4 100644 --- a/nodes/collection/iterator.go +++ b/nodes/collection/iterator.go @@ -11,6 +11,13 @@ var ( _ model.Iterator = &ByAttributesIterator{} ) +// Adapted from gonum/graph/iterator/nodes.go +// Reference: https://github.com/gonum/gonum/blob/master/graph/iterator/nodes.go +// Copyright ©2013 The Gonum Authors. All rights reserved. +// Use of this source code is governed by a BSD-style + +// Note(jpower432): Could possibly removed or deprecated. I do not believe this is used anywhere. + // InOrderIterator implements the model.Iterator interface and traverse the nodes // in the order provided. type InOrderIterator struct { diff --git a/nodes/collection/loader/manifest_to_collection.go b/nodes/collection/loader/manifest_to_collection.go index 0d717a3d..a5fc32c1 100644 --- a/nodes/collection/loader/manifest_to_collection.go +++ b/nodes/collection/loader/manifest_to_collection.go @@ -126,6 +126,14 @@ func addOrGetNode(graph *collection.Collection, desc ocispec.Descriptor) (model. return n, nil } +// Adapted from the `oras` content.Successors. +// Reference: https://github.com/oras-project/oras-go/blob/a428ca67f59b94f7365298870bcac78c769b80bd/content/graph.go#L50 +// Copyright The ORAS Authors. +// Apache License 2.0 +// Changes: +// - Added FetcherFunc to allow for custom fetching of content. + + // getSuccessor returns the nodes directly pointed by the current node. This is adapted from the `oras` content.Successors // to allow the use of a function signature to pull descriptor content. func getSuccessors(ctx context.Context, fetcher FetcherFunc, node ocispec.Descriptor) ([]ocispec.Descriptor, error) { diff --git a/registryclient/orasclient/oras.go b/registryclient/orasclient/oras.go index 8a1a039b..de4c3c34 100644 --- a/registryclient/orasclient/oras.go +++ b/registryclient/orasclient/oras.go @@ -426,7 +426,8 @@ func (c *orasClient) setupRepo(ref string) (*remote.Repository, error) { } // TODO(jpower432): PR upstream so that this can be done with the pre-copy option. Currently the error to skip descriptors is -// private https://github.com/oras-project/oras-go/blob/9e5b1419cdedd6240a5bf836c83f75270ba9d74b/copy.go#L49. +// private +// Reference: https://github.com/oras-project/oras-go/blob/9e5b1419cdedd6240a5bf836c83f75270ba9d74b/copy.go#L49. // successorFnWithSparseManifest defines a successor function to use with oras.Copy that will skip any expected linked content (i.e. sparse manifests) func successorFnWithSparseManifests(ctx context.Context, fetcher orascontent.Fetcher, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { diff --git a/registryclient/orasclient/pack.go b/registryclient/orasclient/pack.go index c0984901..2d634fb7 100644 --- a/registryclient/orasclient/pack.go +++ b/registryclient/orasclient/pack.go @@ -32,10 +32,13 @@ var ( ErrInvalidDateTimeFormat = errors.New("invalid date and time format") ) -// PackOptions and Pack are modified version of the upstream oras.Pack. -// The main difference is that the timestamp information is not optional in the annotations. -// To ensure digest reproducibility for this effort, timestamp information will be collected and stored -// in predicate information in the artifact attestations. +// PackOptions and Pack are modified versions of the upstream oras.Pack. +// Reference: https://github.com/oras-project/oras-go/blob/main/pack.go +// Copyright The ORAS Authors. +// Apache License 2.0 +// Changes: +// - Add `DisableTimestamp` option to disable the creation timestamp annotation. + // TODO(jpower432): PR this back to `oras-go` if it makes sense. // PackOptions contains parameters for Pack.