common

package
v0.0.0-...-bf43de0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package common @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2024 central-mirror CLI @Author linngc @License

Package common @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2024 central-mirror CLI @Author linngc @License

Package common @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2024 central-mirror CLI @Author linngc @License

Package common @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2024 central-mirror CLI @Author linngc @License

Package common @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2024 central-mirror CLI @Author linngc @License

Package common @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2024 central-mirror CLI @Author linngc @License

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnCacheCfg

func OnCacheCfg(str string)

OnCacheCfg 初始化配置参数信息到内存 @param str string

Types

type CacheConfig

type CacheConfig struct {
	CosType string `yaml:"cosType" default:"embedFs"  dc:"可以填写参数:本地embedFs/持久化leveldb/minio分布式缓存"`
	Pattern string `yaml:"pattern" default:"" dc:"文件名称格式化"`
}

func GetCacheConfig

func GetCacheConfig() *CacheConfig

GetCacheConfig 获取配置的资源文件信息

type Common

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

Common 通用方法提取

func GetCommon

func GetCommon(ctx context.Context, cosType, proxy, mirror string) (dial *clientV1.ClientV1, com *Common)

GetCommon 仓库连接 @param ctx 上下文 @param cosType 代理仓库对象存储服务类型 @param proxy 缓存类型:如maven/golang/docker/npm/python等等 @param mirror 中央仓库代理地址

func GetGlobalCache

func GetGlobalCache(ctx context.Context, proxy string) (dial *clientV1.ClientV1, com *Common)

GetGlobalCache 创建配置,并实例化缓存服务 @param ctx 上下文 @param proxy 缓存相对地址(缓存类型:如maven/golang/docker/npm/python等等)

func (*Common) AddBatchSync

func (c *Common) AddBatchSync(mirror string, localPaths []string) (err error)

AddBatchSync 异步批量存储 @param mirror 中央仓库代理地址 @param localPath 文件存储路径

func (*Common) AddChannelMapping

func (c *Common) AddChannelMapping(readAll []byte, localPath string) (err error)

AddChannelMapping 将文件存储到本地缓存中 @param localPath 文件存储路径 @param data 文件对象

func (*Common) AddMapping

func (c *Common) AddMapping(readAll []byte, localPath string) (err error)

AddMapping 将文件存储到本地缓存中 @param proxy 缓存类型(alpine/golang/maven/python) @param localPath 文件存储路径 @param data 文件对象

func (*Common) DelMapping

func (c *Common) DelMapping(localPath string) (err error)

DelMapping 删除本地缓存中的文件 @param localPath 文件存储路径

func (*Common) GetInternetMapping

func (c *Common) GetInternetMapping(mirrorPath, localPath string) (u *cacheModel.ObjectsInfo, err error)

GetInternetMapping 从网络上在线获取文件 @param proxy 缓存类型(alpine/golang/maven/python) @param mirror 中央仓库代理地址 @param localPath 文件存储路径

func (*Common) GetMapping

func (c *Common) GetMapping(localPath string) (u *cacheModel.ObjectsInfo, err error)

GetMapping 获取本地缓存中的文件 @param localPath 文件存储路径

func (*Common) GetOrAddMapping

func (c *Common) GetOrAddMapping(mirrorPath, localPath string) (u *cacheModel.ObjectsInfo, err error)

GetOrAddMapping 获取并保存 @param mirrorPath 中央仓库请求路径 @param localPath 文件存储路径

func (*Common) Pings

func (c *Common) Pings() (p map[string]int)

Pings 检查配置的代理仓库是否能正常访问 @param mirror 中央仓库代理地址

Jump to

Keyboard shortcuts

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