core

package
v0.0.0-...-08227c8 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCtxTimeout = 5 * time.Minute
	DefaultLimit      = 20
)
View Source
const (
	DefaultHTTPTimeout = 15 * time.Second
)

Variables

This section is empty.

Functions

func GetManifestBodyCheckSum

func GetManifestBodyCheckSum(imageName string) (uint32, error)

crc32 hash and err

func NSImages

func NSImages(op *SyncOption) ([]string, error)

baseName,不是full name

func Run

func Run(opt *SyncOption)

func Sync

func Sync(opt *SyncOption) error

Types

type CheckSumer

type CheckSumer interface {
	CreatBucket(string) error
	Diff(string, uint32) (bool, error)
	Save(string, uint32) error
}

func NewBolt

func NewBolt(db *bolt.DB) CheckSumer

type Image

type Image struct {
	Name string // basename
	Tag  string

	Success  bool
	CacheHit bool
	Err      error
}

func (*Image) Key

func (img *Image) Key() string

used for bolt.db

func (*Image) String

func (img *Image) String() string

type Images

type Images []*Image

func ImageNames

func ImageNames(opt *SyncOption) (Images, error)

并发获取k8s.gcr.io/$imgName:tag写入chan

func SyncImages

func SyncImages(imgs Images, opt *SyncOption) Images

func (Images) Len

func (imgs Images) Len() int

func (Images) Less

func (imgs Images) Less(i, j int) bool

func (Images) Swap

func (imgs Images) Swap(i, j int)

type SyncOption

type SyncOption struct {
	Auth          auth
	CmdTimeout    time.Duration // command timeout
	SingleTimeout time.Duration // Sync single image timeout
	LiveInterval  time.Duration
	LoginRetry    uint8
	Limit         int // Images sync process limit
	PushRepo      string
	PushNS        string
	QueryLimit    int // Query Gcr images limit
	Retry         int
	RetryInterval time.Duration
	Report        bool // Report sync result
	Ctx           context.Context
	CheckSumer
	Closer     func() error
	DbFile     string
	AdditionNS []string
}

func (*SyncOption) PreRun

func (s *SyncOption) PreRun(cmd *cobra.Command, args []string) error

func (*SyncOption) Verify

func (s *SyncOption) Verify() error

type TagsOption

type TagsOption struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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