Skip to main content

StealthIM FileAPI

文件接口 0.0.1

.proto 文件:./proto/fileapi.proto

hash 计算

hash 算法采用分块 Blake3 进行。具体分块如下:

将文件以预设大小分块(默认为 2048 KiB,需要与服务器一致)后计算每块 Blake3,将计算后的 hash binary 形式拼接后再计算一次 Blake3,得到最终 hash。

构建

依赖

Go 版本:1.24.1

软件包:protobuf protobuf-dev make

命令行工具 protoc make(gnumake)

go mod download
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

命令行

make # 构建并运行
make build # 构建可执行文件

# 构建指定环境
make build_windows
make build_linux
make build_docker

make release # 构建所有平台

make proto # 生成 proto

make clean # 清理

配置

默认会读取当前文件夹 config.toml 文件(不存在会自动生成模板)

docker 镜像为 cfg/config.toml

默认配置:

[server]
host = "127.0.0.1"
port = 50053
log = false

[dbgateway]
host = "127.0.0.1"
port = 50051
conn_num = 5
sql_timeout = 5000 # 单位:ms

[[filestorage]]
host = "127.0.0.1"
port = 50052
id = 0

# 多个存储单元配置
#
# [[filestorage]]
# host = "192.168.xx.xx"
# port = 50052
# id = 1
#
# 请保证 ID 唯一,在迁移时请使用相同的 ID

[storage]
timeout = 1000   # 单位:ms
check_time = 60  # 单位:s
blocksize = 2048 # 单位:KB
# 不建议更改,不超过 2048

也可使用 --config={PATH} 参数指定配置文件路径

命令行工具

命令行工具使用 Typer 构建。

命令行工具在打包前需要使用 makefile 构建 proto。

make proto_t # 生成工具用 proto
make clean # 清理

使用 poetry install 安装。

帮助信息请查看 stimfileapi --help

调试环境

确保你使用的是 Linux 环境并安装了 tmux

确保在父目录以原名 Clone 了 StealthimDBStealthIMFileStorage

make dev
# 命令会运行 run_env.sh

Download files

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

Source Distribution

stimfileapi-0.1.3.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

stimfileapi-0.1.3-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file stimfileapi-0.1.3.tar.gz.

File metadata

  • Download URL: stimfileapi-0.1.3.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for stimfileapi-0.1.3.tar.gz
Algorithm Hash digest
SHA256 77d33ca4276c0238eaeabf7645eeff71d11f98382d4a7b6e41a40d67bc412e3c
MD5 824bb73c22313d3e557ce81e0ec85ede
BLAKE2b-256 72c22e1aa45b3cb4be6413b265b6f3be341b6a82d4ef366c215f75f345d0434d

See more details on using hashes here.

File details

Details for the file stimfileapi-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: stimfileapi-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for stimfileapi-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a430b62e99cd723b297fccca838e6ab0984d50713256bd89ca2ee03a30eb8129
MD5 bb12281881dd370252dc8405d73e9543
BLAKE2b-256 22c3f7a662864e302d018fe7c4ab54ef506935073f559519980b8032a68366a7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

3 files

0.1.1

2 files

0.1.0

2 files

Supported by

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