Skip to main content

Cash is a storage management tool, including project packaging and remote storage.

Project description

Cask-存储管理工具

shields_version shields_license shields_author shiedls_python

casksymbol

介绍

  • 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图: caskuml

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shihua-cask-0.1.tar.gz (11.1 kB view hashes)

Uploaded Source

Built Distribution

shihua_cask-0.1-py3-none-any.whl (14.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page