Skip to main content

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

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file shihua-cask-0.1.tar.gz.

File metadata

  • Download URL: shihua-cask-0.1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for shihua-cask-0.1.tar.gz
Algorithm Hash digest
SHA256 22456f630dac18779a193515d2fd068879833a59c0e21b7f40f9d091a44a3007
MD5 876ef1f5e5b2cf630d95620356b6088d
BLAKE2b-256 e5c989f5b974d0d3394a549ced4cbcbf9b2bd20cda4b00648622031cd9a089dd

See more details on using hashes here.

File details

Details for the file shihua_cask-0.1-py3-none-any.whl.

File metadata

  • Download URL: shihua_cask-0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for shihua_cask-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b397bacd65f72992240192d02ecaffcde231cce5ffa7737090355cc5d595189
MD5 ac9f3091dfeb9111e8eceff0a8692e10
BLAKE2b-256 910c8b99c72d53a2a969d0a692920db489c0994769a35c4cb0c9402bf5c8e62d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page