client

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFileLogger

func NewFileLogger(path string) *logrus.Logger

NewFileLogger creates a log file and init logger

Types

type Auth

type Auth struct {
	Username      string `json:"username" yaml:"username"`
	Password      string `json:"password" yaml:"password"`
	Insecure      bool   `json:"insecure" yaml:"insecure"`
	IdentityToken string `json:"identityToken" yaml:"identityToken"`
}

Auth describes the authentication information of a registry

type Client

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

Client describes a synchronization client

func NewSyncClient

func NewSyncClient(configFile, authFile, imageFile, logFile string,
	routineNum, retries int, defaultDestRegistry, defaultDestNamespace string,
	osFilterList, archFilterList []string) (*Client, error)

NewSyncClient creates a synchronization client

func (*Client) GenerateSyncTask

func (c *Client) GenerateSyncTask(source string, destination string) ([]*URLPair, error)

GenerateSyncTask creates synchronization tasks from source and destination url, return URLPair array if there are more than one tags

func (*Client) GetAFailedTask

func (c *Client) GetAFailedTask() (*sync.Task, bool)

GetAFailedTask gets a failed task from failedTaskList

func (*Client) GetAFailedURLPair

func (c *Client) GetAFailedURLPair() (*URLPair, bool)

GetAFailedURLPair get a URLPair from failedTaskGenerateList

func (*Client) GetATask

func (c *Client) GetATask() (*sync.Task, bool)

GetATask return a sync.Task struct if the task list is not empty

func (*Client) GetAURLPair

func (c *Client) GetAURLPair() (*URLPair, bool)

GetAURLPair gets a URLPair from urlPairList

func (*Client) PutAFailedTask

func (c *Client) PutAFailedTask(failedTask *sync.Task)

PutAFailedTask puts a failed task to failedTaskList

func (*Client) PutAFailedURLPair

func (c *Client) PutAFailedURLPair(failedURLPair *URLPair)

PutAFailedURLPair puts a URLPair to failedTaskGenerateList

func (*Client) PutATask

func (c *Client) PutATask(task *sync.Task)

PutATask puts a sync.Task struct to task list

func (*Client) PutURLPairs

func (c *Client) PutURLPairs(urlPairs []*URLPair)

PutURLPairs puts a URLPair array to urlPairList

func (*Client) Run

func (c *Client) Run()

Run is main function of a synchronization client

type Config

type Config struct {
	// the authentication information of each registry
	AuthList map[string]Auth `json:"auth" yaml:"auth"`

	// a <source_repo>:<dest_repo> map
	ImageList map[string]string `json:"images" yaml:"images"`
	// contains filtered or unexported fields
}

Config information of sync client

func NewSyncConfig

func NewSyncConfig(configFile, authFilePath, imageFilePath, defaultDestRegistry, defaultDestNamespace string,
	osFilterList, archFilterList []string) (*Config, error)

NewSyncConfig creates a Config struct

func (*Config) GetAuth

func (c *Config) GetAuth(registry string, namespace string) (Auth, bool)

GetAuth gets the authentication information in Config

func (*Config) GetImageList

func (c *Config) GetImageList() map[string]string

GetImageList gets the ImageList map in Config

type URLPair

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

URLPair is a pair of source and destination url

Jump to

Keyboard shortcuts

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