WormDb 1.0.3
dotnet add package WormDb --version 1.0.3
NuGet\Install-Package WormDb -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WormDb" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WormDb" Version="1.0.3" />
<PackageReference Include="WormDb" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WormDb --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WormDb, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WormDb@1.0.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WormDb&version=1.0.3
#tool nuget:?package=WormDb&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
WormDb
WormDb 的 CLI 入口和 HTTP API 宿主,支持 4 种运行模式:standalone / leader / follower / benchmark。
可直接编译为单文件可执行程序(
wormdb),零外部依赖部署。
功能
| 模式 | 说明 |
|---|---|
| standalone | 单节点完整读写,内置 HTTP REST API |
| leader | gRPC 汇聚节点,接收 Follower 推流,只读 HTTP API |
| follower | 接受写入,本地落盘后异步推送到 Leader |
| benchmark | 写入吞吐量压测 |
CLI 命令
# Standalone 单节点
wormdb standalone [--port 8080] [--data ./data] [--tag-index level,service]
# Leader 汇聚节点
wormdb leader [--port 5100] [--api-port 8080] [--node-id 0]
# Follower 写入节点
wormdb follower --leader http://localhost:5100 --node-id 1 [--api-port 8081]
# 压测
wormdb benchmark [--count 100000] [--batch-size 1000]
HTTP REST API
写入
# 单条写入
POST /api/entries
Content-Type: application/json
{
"level": "INFO",
"service": "order-service",
"message": "Order created",
"tags": { "userId": "12345", "orderId": "ORD-001" }
}
# 批量写入
POST /api/entries/batch
Content-Type: application/json
[
{ "level": "INFO", "service": "svc1", "message": "msg1" },
{ "level": "ERROR", "service": "svc2", "message": "msg2" }
]
查询
# 时间范围查询
GET /api/entries?from={ns}&to={ns}&limit=100
# 分页查询
GET /api/entries/paged?from={ns}&to={ns}&page_size=20&page=1&order=desc
# 最新一条
GET /api/entries/latest
# 节点统计
GET /api/stats
# 健康检查
GET /api/health
Follower 专属
# 优雅退出(排空 Channel 后关闭)
POST /api/shutdown
核心组件
| 文件 | 说明 |
|---|---|
Program.cs |
CLI 入口,命令行解析,4 种运行模式调度 |
依赖
<ProjectReference Include="..\WormDb.Core\WormDb.Core.csproj" />
<ProjectReference Include="..\WormDb.Cluster\WormDb.Cluster.csproj" />
<Project Sdk="Microsoft.NET.Sdk.Web">
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</Project>
构建
dotnet publish -c Release -r linux-x64 --self-contained true /p:PublishSingleFile=true
# 输出:bin/Release/net8.0/linux-x64/publish/wormdb
快速开始
# 1. 启动 Standalone
cd src/WormDb
dotnet run -- standalone --port 8080 --data ./data
# 2. 写入日志
curl -X POST http://localhost:8080/api/entries \
-H "Content-Type: application/json" \
-d '{"level":"INFO","service":"demo","message":"Hello WormDb"}'
# 3. 查询日志
curl "http://localhost:8080/api/entries?limit=10"
# 4. 启动 Leader + Follower 集群
# Terminal 1: Leader
wormdb leader --port 5100 --api-port 8080
# Terminal 2: Follower
wormdb follower --leader http://localhost:5100 --node-id 1 --api-port 8081
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- WormDb.Cluster (>= 1.0.2)
- WormDb.Core (>= 1.0.4)
-
net8.0
- WormDb.Cluster (>= 1.0.2)
- WormDb.Core (>= 1.0.4)
-
net9.0
- WormDb.Cluster (>= 1.0.2)
- WormDb.Core (>= 1.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.3 | 42 | 6/2/2026 |