搜索插件、代码仓与 APP 分类

插件详情v1.2.0+1

hlc_dart

基于论文《全局分布式数据库中的逻辑物理时钟与一致快照》的 Dart 混合逻辑时钟实现。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
637
喜欢数
5
Pub 分数
160

安装插件

flutter pub add hlc_dart

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

HLC_Dart 是 Hybrid Logical Clock(混合逻辑时钟)的 Dart 实现,旨在为分布式系统提供因果一致的时间戳。受逻辑物理时钟论文启发,它结合了逻辑时间和物理时间的优点,确保在全球分布式数据库中实现强一致性。HLC_Dart 能够精确排序事件,同时与现实世界时间保持同步,非常适合用于 CRDT 和分布式账本。该包支持多种平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。

适合场景

  • 分布式数据库时间戳
  • CRDT 冲突解决
  • 微服务中的全局事件排序
  • 复制系统中的一致快照
  • 实时协作应用

主要特点

  • 混合逻辑-物理时间同步
  • 跨节点的因果一致性
  • 低延迟时间戳生成
  • 跨平台支持
  • 与 CRDT 的集成

适合对象

  • 开发分布式系统的开发者
  • 使用CRDT实现数据一致性的团队
  • 需要全局事件排序的应用程序
  • 多区域部署中的后端服务

使用建议

  • 需要仔细处理时钟漂移
  • 不适合高精度计时需求
  • 依赖准确的系统时间源
  • 在边缘情况下可能需要网络协调
  • 最适合在具有稳定网络连接的环境中使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

CRDT

github_starts melos_badge repo_size

logo

docs_badge

Apps

Packages

Roadmap

A roadmap is available in the project page. The roadmap provides a high-level overview of the project's goals and the current status of the project.

Workspace structure

This repository is a workspace that contains multiple packages and apps. Consistency is granted by the melos tool.

Melos

Melos (pub.dev) is a CLI tool for Dart/Flutter monorepos. It links the local packages together, so every package can depend on the others without publishing them first, and it runs the same command over all of them (format, analyze, test, publish, ...).

Every shared command lives in melos.yaml and runs with melos run <script>:

Script What it does
format formats the code (80 characters per line)
analyze runs the analyzer with warnings and infos as errors
test / test_flutter / test_chrome runs the Dart, Flutter and web tests
benchmark runs the benchmarks of every package with a benchmarks/ folder
devtools_build builds the DevTools extension
docs_bs / docs_build bootstraps and builds the documentation site
update_references propagates package/app references into the READMEs
Setup

The Flutter SDK is pinned with fvm, and the documentation site is a Docusaurus project, so Node.js (with npm) is required too.

fvm install                     # installs the pinned Flutter SDK
fvm dart pub get                # resolves the workspace tools (melos included)
fvm dart run melos bootstrap    # links the packages and prepares the examples
fvm dart run melos run docs_bs  # optional: installs the documentation site (needs Node.js)

Note Melos is a dev_dependency of the root pubspec.yaml, so running it as fvm dart run melos ... is the safest option: you use the melos version pinned by this repository, with the Flutter/Dart SDK pinned by fvm. A globally activated melos (dart pub global activate melos) works as well, but it may be a different version than the one the workspace expects, and the difference usually shows up at the worst possible moment 🙃.

A command is provided to try to publish all packages:

fvm dart run melos publish --dry-run

This ensures that every package is formatted, analyzed, tested and built.

Organization

The repository structure is organized as follows:

workspace/
├── melos.yaml # melos configuration file
├── packages/ # contains every package of the workspace
│   ├── core/ # the CRDT engine and its bindings
│   │   ├── crdt_lf/
│   │   │   ├── lib/
│   │   │   ├── example/
│   │   │   └── flutter_example/
│   │   └── .../
│   ├── adapters/
│   │   └── persistence/ # storage backends for crdt_lf
│   │       ├── crdt_lf_drift/
│   │       ├── crdt_lf_hive/
│   │       └── crdt_lf_sqlite/
│   └── _internal/ # private, unpublished packages
│       ├── benchmark_infrastructure/
│       └── shared_examples_infrastructure/
├── apps/ # contains the applications built on top of the packages
│   └── greyhound_markdown/
│       ├── client/
│       └── server/
├── docs/ # the documentation site (Docusaurus, Node.js project)
├── scripts/ # dart scripts used by the melos commands
└── assets/ # contains the assets used in the documentation
    └── .../
VS Code

If you work with VS Code, the repository already contains a .vscode folder with:

  • the recommended extensions (Dart, Flutter, Melos, Mermaid);
  • the settings (fvm SDK path, project dictionary for the spell checker);
  • the launch configurations for the apps and the examples;
  • the snippets used in the READMEs and the changelogs.

Accepting the recommended extensions gives you the smoothest experience on this workspace.

Contributing

Contributions are welcome: bug fixes, new features, documentation, performance work, or anything else — a fixed typo counts too 💚.

The whole flow (roadmap, issues, pull requests, AI-assisted work) is described in CONTRIBUTING.md. Please read it before opening an issue or a pull request.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。