storage

package
v0.0.0-...-a6b6bab Latest Latest
Warning

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

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

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

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 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

func (c *Storage) Add(readAll []byte, localPath string) (err error)

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

func (*Storage) AddBatchSync

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

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

func (*Storage) AddChannel

func (c *Storage) AddChannel(readAll []byte, localPath string) (err error)

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

func (*Storage) Del

func (c *Storage) Del(localPath string) (err error)

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

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 文件存储路径

Jump to

Keyboard shortcuts

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