Documentation ¶
Overview ¶
Package storage @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2024 central-mirror CLI @Author linngc @License
Package storage @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2024 central-mirror CLI @Author linngc @License
Package storage @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2024 central-mirror CLI @Author linngc @License
Package storage @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2024 central-mirror CLI @Author linngc @License
Package storage @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2024 central-mirror CLI @Author linngc @License
Index ¶
- func OnCacheCfg(str string)
- type CacheConfig
- type Storage
- func (c *Storage) Add(readAll []byte, localPath string) (err error)
- func (c *Storage) AddBatchSync(mirror string, localPaths []string) (err error)
- func (c *Storage) AddChannel(readAll []byte, localPath string) (err error)
- func (c *Storage) Del(localPath string) (err error)
- func (c *Storage) Get(localPath string) (u *cacheModel.ObjectsInfo, err error)
- func (c *Storage) GetInternet(mirrorPath, localPath string) (u *cacheModel.ObjectsInfo, err error)
- func (c *Storage) GetOrAdd(mirrorPath, localPath string) (u *cacheModel.ObjectsInfo, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CacheConfig ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage 通用方法提取
func Get ¶
func Get(ctx context.Context, cosType memorycacheEnums.CosType, proxy enums.ProxyType, mirror string) (dial *clientV1.ClientV1, com *Storage)
Get 仓库连接 @param ctx 上下文 @param cosType 代理仓库对象存储服务类型 @param proxy 缓存类型:如maven/golang/docker/npm/python等等 @param mirror 中央仓库代理地址
func GetGlobalCache ¶
func GetGlobalCache(ctx context.Context, proxy enums.ProxyType, mirror ...string) (dial *clientV1.ClientV1, com *Storage, cosType string)
GetGlobalCache 创建配置,并实例化缓存服务 @param ctx 上下文 @param proxy 缓存相对地址(缓存类型:如maven/golang/docker/npm/python等等) @param mirror 中央仓库代理地址
func (*Storage) Add ¶
Add 将文件存储到本地缓存中 @param proxy 缓存类型(alpine/golang/maven/python) @param localPath 文件存储路径 @param data 文件对象
func (*Storage) AddBatchSync ¶
AddBatchSync 异步批量存储 @param mirror 中央仓库代理地址 @param localPath 文件存储路径
func (*Storage) AddChannel ¶
AddChannel 将文件存储到本地缓存中 @param localPath 文件存储路径 @param data 文件对象
func (*Storage) Get ¶
func (c *Storage) Get(localPath string) (u *cacheModel.ObjectsInfo, err error)
Get 获取本地缓存中的文件 @param localPath 文件存储路径
func (*Storage) GetInternet ¶
func (c *Storage) GetInternet(mirrorPath, localPath string) (u *cacheModel.ObjectsInfo, err error)
GetInternet 从网络上在线获取文件 @param proxy 缓存类型(alpine/golang/maven/python) @param mirror 中央仓库代理地址 @param localPath 文件存储路径
func (*Storage) GetOrAdd ¶
func (c *Storage) GetOrAdd(mirrorPath, localPath string) (u *cacheModel.ObjectsInfo, err error)
GetOrAdd 获取并保存 @param mirrorPath 中央仓库请求路径 @param localPath 文件存储路径