搜尋套件、儲存庫與 APP 分類

套件詳情v5.1.3

crdt

衝突自由複製資料類型(CRDT)的 Dart 實現。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2620
喜歡數
83
Pub 分數
150

安裝套件

flutter pub add crdt

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一種衝突無害複製資料類型(CRDT)的Dart實作,可在分散式系統中實現一致且即時的協作,無需協調。即使在網路分割或同時更新的情況下,CRDT仍能確保資料收斂,非常適合用於共享文件、即時儀表板和多人遊戲等協作應用。此套件支援多種平台,包括行動裝置、網頁和桌面,確保跨平台的一致性。

適用情境

  • 即時協同編輯
  • 分散式狀態同步
  • 離線優先的應用程式
  • 多人遊戲狀態管理
  • 即時儀表板更新

主要特色

  • 無衝突的資料收斂
  • 對多種 CRDT 類型的支援
  • 跨平台相容性
  • 低延遲更新
  • 無需中央協調

適合對象

  • 開發即時應用程式的開發者
  • 需要離線優先功能的團隊
  • 具有分散式使用者的應用程式
  • 需要強一致性之協作工具
  • 網路條件不可靠的系統

使用建議

  • 需要理解 CRDT 原理
  • 由於資料複製,可能會增加資料大小
  • 不適合高頻率原子操作
  • 限於特定資料結構
  • 效能取決於資料複雜度

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Dart implementation of Conflict-free Replicated Data Types (CRDTs).

This project is heavily influenced by James Long's talk CRTDs for Mortals and includes a Dart-native implementation of Hybrid Local Clocks (HLC) based on the paper Logical Physical Clocks and Consistent Snapshots in Globally Distributed Databases (pdf).

It has minimal external dependencies, so it should run anywhere where Dart runs, which is pretty much everywhere.

The Crdt class implements CRDT conflict resolution and serves as a storage-agnostic interface for specific implementations. Als included with this package is MapCrdt, an ephemeral implementation using Dart HashMaps.

Other implementations include (so far):

  • hive_crdt, a no-sql implementation using Hive as persistent storage.
  • sql_crdt, an abstract implementation for using relational databases as a data storage backend.
  • sqlite_crdt, an implementation using Sqlite for storage, useful for mobile or small projects.
  • postgres_crdt, a sql_crdt that benefits from PostgreSQL's performance and scalability intended for backend applications.

See also crdt_sync, a turnkey approach for real-time network synchronization of Crdt nodes.

Usage

The simplest way to experiment with this package is to use the provided MapCrdt implementation:

import 'package:crdt/map_crdt.dart';

void main() {
  var crdt1 = MapCrdt(['table']);
  var crdt2 = MapCrdt(['table']);

  print('Inserting 2 records in crdt1…');
  crdt1.put('table', 'a', 1);
  crdt1.put('table', 'b', 1);

  print('crdt1: ${crdt1.getMap('table')}');

  print('\nInserting a conflicting record in crdt2…');
  crdt2.put('table', 'a', 2);

  print('crdt2: ${crdt2.getMap('table')}');

  print('\nMerging crdt2 into crdt1…');
  crdt1.merge(crdt2.getChangeset());

  print('crdt1: ${crdt1.getMap('table')}');
}

Implementations

crdt is currently helping build local-first experiences for:

  • Libra a weigh management app with 1M+ installs.
  • tudo an open-source simple to-do app + backend.

Are you using this package in your project? Let me know!

Features and bugs

Please file feature requests and bugs at the issue tracker.

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。