Metadata-Version: 2.1
Name: shihua-cask
Version: 0.1
Summary: Cash is a storage management tool, including project packaging and remote storage.
Home-page: https://github.com/redblue0216/Cask
Author: shihua
Author-email: 15021408795@163.com
License: MIT
Platform: UNKNOWN
Requires-Python: >=3.9.12
Description-Content-Type: text/markdown
License-File: LICENSE

# Cask-存储管理工具

![shields_version](/static/shields_version.svg)    ![shields_license](/static/shields_license.svg)    ![shields_author](/static/shields_author.svg)    ![shiedls_python](/static/shields_python.svg)

![casksymbol](/static/casksymbol.JPG)

## 介绍
+ cask是一个存储管理工具，主要功能包括项目本地打包，远端存储管理两大功能，主要设计仿制wheel文件格式，远端存储采用MinIO技术。


## 安装
cask采用Python开发，得益于Python良好的社区环境，安装支持Pythonic风格的各种管理器。
```
	$ pip install cask-0.1-xxxxxxxxxxxx.whl
```


## 快速指南

### python-sdk使用
+ cask提供python-sdk的存储管理，以下是cask主程脚本示例：：

```python
	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命令行示例：
```bash
	$ 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图：
![caskuml](/static/caskUML.png)



