peerclient

package
v0.0.0-...-9e42072 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client can be used for API access to one of our peers (using our peering credentials).

func New

func New(ctx context.Context, cfg keppel.Configuration, peer models.Peer, scope auth.Scope) (Client, error)

New obtains a token for API access to the given peer (using our peering credentials), and wraps it into a Client instance.

func (Client) DownloadManifestViaPullDelegation

func (c Client) DownloadManifestViaPullDelegation(ctx context.Context, imageRef models.ImageReference, userName, password string) (respBodyBytes []byte, contentType string, err error)

DownloadManifestViaPullDelegation asks the peer to download a manifest from an external registry for us. This gets used when the external registry denies the pull to us because we hit our rate limit.

func (Client) GetForeignAccountConfigurationInto

func (c Client) GetForeignAccountConfigurationInto(ctx context.Context, target any, accountName models.AccountName) error

GetForeignAccountConfiguration asks the peer for the configuration of the specified account on its side. We use this to match certain account attributes with the primary account when creating a replica.

The configuration is deserialized into `target`, which must have the type `*keppelv1.Account`. We cannot return this type explicitly because that would create an import cycle between this package and package keppelv1.

func (Client) GetSubleaseToken

func (c Client) GetSubleaseToken(ctx context.Context, accountName models.AccountName) (keppel.SubleaseToken, error)

GetSubleaseToken asks the peer for a sublease token for this account to replicate it on another Keppel instance. Only the primary instance of an account can be asked for a sublease token.

func (Client) PerformReplicaSync

func (c Client) PerformReplicaSync(ctx context.Context, fullRepoName string, payload keppel.ReplicaSyncPayload) (*keppel.ReplicaSyncPayload, error)

PerformReplicaSync uses the replica-sync API to perform an optimized manifest/tag sync with an upstream repo that is managed by one of our peers.

If the repo is deleted on upstream (i.e. 404 is returned), this function will return (nil, nil) to signal to the caller that a detailed deletion check should be performed.

Jump to

Keyboard shortcuts

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