Cask-存储管理工具
介绍
- cask是一个存储管理工具,主要功能包括项目本地打包,远端存储管理两大功能,主要设计仿制wheel文件格式,远端存储采用MinIO技术。
安装
cask采用Python开发,得益于Python良好的社区环境,安装支持Pythonic风格的各种管理器。
$ pip install cask-0.1-xxxxxxxxxxxx.whl
快速指南
python-sdk使用
- cask提供python-sdk的存储管理,以下是cask主程脚本示例::
from cask import create_cask_workspace,generate_cask_package,install_caskpkg,seriallize,deseriallize
from cask.package import Caskpkg
from cask.store import CaskStore
### 创建cask工作空间,生成.cask隐藏文件夹
# create_cask_workspace()
### 生成cask包
# generate_cask_package(caskpkg_name='testcask')
### 安装cask包,生成.cask隐藏文件夹
# install_caskpkg(caskpkg_file='testcask.caskpkg')
### 添加object_file到.cask下
# tmp_caskpkg = Caskpkg(objects=['logtest'],scripts=['install_script.sh'],configs=['test.yaml'])
# tmp_caskpkg.commit()
### 初始化cask存储对象
caskstore = CaskStore(endpoint='192.168.1.82:9000')
### 临时函数
def testfunc(a):
return a + 1
### 序列化对象到文件
seriallize(target_object=testfunc,filepath='testfunc.dill')
### 序列化对象
testfunc_bytes_obj = seriallize(target_object=testfunc)
### 上传二进制对象
result = caskstore.push_object(bucket_name='cask',object_name='testfunc',bytes_obj=testfunc_bytes_obj)
print(result)
### 获取二进制对象
tmp_bytes_obj = caskstore.pull_object(bucket_name='cask',object_name='testfunc')
### 反序列化对象
testfunc_bytes_obj_a = deseriallize(target_object=tmp_bytes_obj)
print(testfunc_bytes_obj_a(1))
### 上传文件
result = caskstore.push_file(bucket_name='cask',object_name='testfunc.dill',file_path='testfunc.dill')
print(result)
### 获取文件
caskstore.pull_file(bucket_name='cask',object_name='testfunc.dill',file_path='testfunc.dill')
### 反序列化对象
testfunc_bytes_obj_aaa = deseriallize(filepath='testfunc.dill')
print(testfunc_bytes_obj_aaa(2))
命令行使用
- cask提供命令行的存储管理,以下是cask命令行示例:
$ caskctl create-workspace
$ caskctl generate-package --caskpkg_name testcask
$ caskctl install-package --caskpkg_file testcask.caskpkg
$ caskctl upload-file --endpoint 192.168.1.82:9000 --bucket_name cask --object_name test.yaml --file_path test.yaml
$ caskctl doenload-file --endpoint 192.168.1.82:9000 --bucket_name cask --object_name test.yaml --file_path test.yaml
设计
- 仿制wheel格式设计caskpkg打包格式
- 使用MinIO作为远端存储
- 支持本地打包和远端存储两大功能
技术列表
- __init__收集基础操作函数
- __all__暴露指定功能
- .cask隐藏文件夹
- yaml配置文件
- MinIO远端存储
- Tar压缩包技术
设计UML图
以下是设计的UML图:
Metadata
Release files for shihua-cask 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shihua-cask-0.1.tar.gz | 11.1 kB | Without provenance | Details for shihua-cask-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shihua_cask-0.1-py3-none-any.whl | Python 3 | none | any | Details for shihua_cask-0.1-py3-none-any.whl |
Total release size: 25.2 kB
Release files / shihua-cask-0.1.tar.gz
| Download URL | shihua-cask-0.1.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22456f630dac18779a193515d2fd068879833a59c0e21b7f40f9d091a44a3007
|
|
BLAKE2b-256 checksum How to use checksums |
e5c989f5b974d0d3394a549ced4cbcbf9b2bd20cda4b00648622031cd9a089dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Release files / shihua_cask-0.1-py3-none-any.whl
| Download URL | shihua_cask-0.1-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b397bacd65f72992240192d02ecaffcde231cce5ffa7737090355cc5d595189
|
|
BLAKE2b-256 checksum How to use checksums |
910c8b99c72d53a2a969d0a692920db489c0994769a35c4cb0c9402bf5c8e62d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Security for shihua-cask 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.