idgen

package
v2.5.4 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// FilteredQueryParamsSeparator is the separator of filtered query params.
	FilteredQueryParamsSeparator = "&"
)

Variables

View Source
var (
	// S3FilteredQueryParams is the default filtered query params with s3 protocol to generate the task id.
	S3FilteredQueryParams = []string{
		"X-Amz-Algorithm",
		"X-Amz-Credential",
		"X-Amz-Date",
		"X-Amz-Expires",
		"X-Amz-SignedHeaders",
		"X-Amz-Signature",
		"X-Amz-Security-Token",
		"X-Amz-User-Agent",
	}

	// GcsFilteredQueryParams is the filtered query params with gcs protocol to generate the task id.
	GcsFilteredQueryParams = []string{
		"X-Goog-Algorithm",
		"X-Goog-Credential",
		"X-Goog-Date",
		"X-Goog-Expires",
		"X-Goog-SignedHeaders",
		"X-Goog-Signature",
	}

	// OssFilteredQueryParams is the default filtered query params with oss protocol to generate the task id.
	OssFilteredQueryParams = []string{
		"OSSAccessKeyId",
		"Expires",
		"Signature",
		"SecurityToken",
	}

	// ObsFilteredQueryParams is the default filtered query params with obs protocol to generate the task id.
	ObsFilteredQueryParams = []string{
		"AccessKeyId",
		"Signature",
		"Expires",
		"X-Obs-Date",
		"X-Obs-Security-Token",
	}

	// CosFilteredQueryParams is the default filtered query params with cos protocol to generate the task id.
	CosFilteredQueryParams = []string{
		"q-sign-algorithm",
		"q-ak",
		"q-sign-time",
		"q-key-time",
		"q-header-list",
		"q-url-param-list",
		"q-signature",
		"x-cos-security-token",
	}

	// ContainerdFilteredQueryParams is the default filtered query params with containerd to generate the task id.
	ContainerdFilteredQueryParams = []string{
		"ns",
	}
)

DefaultFilteredQueryParams is the default filtered query params to generate the task id.

Functions

func FormatFilteredQueryParams added in v2.3.1

func FormatFilteredQueryParams(params []string) string

FormatFilteredQueryParams formats a slice of strings into a filtered query params string.

func HostID

func HostID(ip, hostname string, isSeedPeer bool) string

HostID generates host id.

func IsBlobURL added in v2.5.2

func IsBlobURL(url string) bool

IsBlobURL reports whether the url is an OCI blob URL.

func IsManifestDigestURL added in v2.5.2

func IsManifestDigestURL(url string) bool

IsManifestDigestURL reports whether the url is an OCI manifest URL whose reference is a digest, e.g. http(s)://<registry>/v2/<repository>/manifests/sha256:<hex>. A manifest url referenced by a tag returns false, so it falls back to the url based task id.

func ParseFilteredQueryParams added in v2.1.62

func ParseFilteredQueryParams(rawFilteredQueryParams string) []string

ParseFilteredQueryParams parses filtered query params.

func PeerID

func PeerID() string

PeerID generates peer id.

func PersistentCacheTaskIDByContent added in v2.2.3

func PersistentCacheTaskIDByContent(content string) string

PersistentCacheTaskIDByContent generates persistent cache task id by content.

func TaskIDV1 added in v2.0.9

func TaskIDV1(url string, meta *commonv1.UrlMeta) string

TaskIDV1 generates v1 version of task id. filter is separated by & character.

func TaskIDV2 added in v2.0.9

func TaskIDV2(url string, pieceLength *uint64, tag, application string, filteredQueryParams []string, content string, enableTaskIDBasedBlobDigest bool) (string, error)

TaskIDV2 generates v2 version of task id, selecting the generator by the parameters, identical to the client's task id generation. If the content is not empty, generate the task id by the content. If the task id based blob digest is enabled and the url is an OCI blob url or an OCI manifest url referenced by a digest, generate the task id by the digest. Otherwise, generate the task id by the url based parameters.

func TaskIDV2ByBlobDigest added in v2.5.2

func TaskIDV2ByBlobDigest(url string) (string, error)

TaskIDV2ByBlobDigest generates v2 version of task id by the digest extracted from the OCI blob url.

func TaskIDV2ByContent added in v2.2.3

func TaskIDV2ByContent(content string) string

TaskIDV2ByContent generates v2 version of task id by content.

func TaskIDV2ByManifestDigest added in v2.5.2

func TaskIDV2ByManifestDigest(url string) (string, error)

TaskIDV2ByManifestDigest generates v2 version of task id by the digest extracted from the OCI manifest url.

func TaskIDV2ByURLBased added in v2.2.3

func TaskIDV2ByURLBased(url string, pieceLength *uint64, tag, application string, filteredQueryParams []string, revision string) string

TaskIDV2ByURLBased generates v2 version of task id by url based.

Types

This section is empty.

Jump to

Keyboard shortcuts

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