#ecs #atomic #data-structures #entity-attribute #double-indexed

retable

An Atomic-like double indexed entity-attribute data structures

14 releases

0.7.0-alpha.5 Jan 9, 2024
0.7.0-alpha.3 Dec 30, 2023
0.5.0 Nov 28, 2023

#1155 in Database interfaces

Download history 4/week @ 2024-09-18 2/week @ 2024-09-25 3/week @ 2024-10-02

310 downloads per month

MIT license

17KB
266 lines

Retable

A Rust library for Atomic-like double-indexed entity-attribute data structures.

This lib comes with:

  • Atom protocol, a protocol to describe the modify of the database.
  • A simple implementation of the atom protocol, using [im].

Atom

Atom is a way to describe the modify of the database.

Data Part Data Type Field length Description
Opration u8 1 byte Enum of four basic modify ops.
Key K(Generic) Zero or Any The type of index key.
Value V(Generic) Zero or Any The type of storage value.
Delta D(Generic) Zero or Any The type of modify value.
  • Endian: Little Endian, rust native.
  • Codec: Using rust zerocopy to encode/decode.

Note that since the data struct is defined by user, there is no placeholder for empty field. In an other word, Atom use a packed layout to store the data. Therefore, these structs have the same memory layout:

  • Atom<u8,u16,()>
  • Atom<u8,(),u16>
  • Atom<u8,u8,u8>
  • Atom<u16,u8,()>
  • etc...

Roadmap

  • Freeze Atom protocol .
  • Use im asBasic implementation.
  • Support async non-block op.
  • Documentation.
  • External Message queue support.
  • Benchmark.
  • Auto shrink inner data to make more density.

Written by RuofengX · Used in entropy-rs, the Game

License by MIT.

Dependencies

~1.3–6.5MB
~38K SLoC