8000 GitHub - loro-dev/loro-ffi: FFI binding for loro
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

loro-dev/loro-ffi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Loro FFI

MIT License Version Rust

Foreign Function Interface (FFI) bindings for Loro, a high-performance CRDT library for building collaborative applications.

Overview

Loro FFI provides cross-language bindings for the Loro CRDT library, enabling developers to use Loro's powerful collaborative editing capabilities in various programming languages. Built with UniFFI, this library generates clean, idiomatic bindings for multiple target languages.

Supported Languages

Build Binding

Read the UniFFI documentation and modify the uniffi.toml configuration in this repository as needed.

Add this repository as a git submodule for your bindings:

git submodule add https://github.com/loro-dev/loro-ffi.git loro-ffi
git add .gitmodules loro-ffi

Build language-specific wrapper layers around the current UniFFI binding results to provide a better developer experience, including but not limited to:

  • Callback Function Wrapping: Provide direct closure support for functions that require callback parameters, such as LoroDoc::subscribe(), UndoManager::set_on_push(), and EphemeralStore::subscribe().

  • Native Type Extensions: Implement LoroValueLike ContainerIdLike extensions for built-in types in target languages, enabling direct parameter usage:

    LoroMap.insert("key", "value");
    LoroMap.insert("key", 123);
    LoroMap.insert("key", true);
    LoroMap.insert("key", [1, 2, 3]);
    // ... and more
  • Unified Export Interface: Create a unified entry point for LoroDoc::export:

    class LoroDoc {
      function export(mode: ExportMode) {
          // Wraps:
          // exportSnapshot()
          // exportUpdates(from)
          // exportUpdatesInRange(spans)
          // exportShallowSnapshot(frontiers)
          // exportStateOnly(frontiers)
          // exportSnapshotAt(frontiers)
      }
    }
  • Unified Container Creation Interface: Provide unified entry points for creating child containers in LoroMap/LoroList/LoroMovableList:

    class LoroMap {
      function insertContainer(key: string, child: Container) {
          // Wraps:
          // insertListContainer
          // insertMapContainer
          // insertTextContainer
          // insertTreeContainer
          // insertMovableListContainer
          // insertCounterContainer
      }
      function getOrCreateContainer() {}
      // ... and more
    }
  • Standard Language Interfaces: Implement essential interfaces (equality, comparison, ordering, etc.) for necessary data types as required by target programming languages.

  • Additional Enhancements: And many other improvements to enhance usability and developer experience.

Community

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

FFI binding for loro

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •  

Languages

0