Giter Site home page Giter Site logo

graphlite's Introduction

Just thinking out loud...

bare minimum: write k/v docs, collect and link them by id keys = bytes values = bytes ids = integer

ID gen options

  • BYO
  • Assigned
    • break id space into chunks, assign chunks to nodes. means max nodes are a hard limit but that's probably fine. make it setup config (of the collection?).
    • leader election and replication for id assignment. slower...

Keyspaces

  • docs:
    • key
    • value
  • collections:
    • entity
    • id
    • key
  • links:
    • key
    • to_entity
    • ids

Operations

  • write:
    • put docs:key/value
  • assign(key,entity,id):
    • put collections:entity/id/key
  • link:
    • merge links:key/to_entity/[ids+id]
  • get(key):
    • get docs:key/value
  • is_linked_to(from_key,to_entity,to_id):
    • get links:key/to_entity/ids.contains(to_id)
  • get_linked_ids(from_key):
    • get links:key/to_entity/ids
  • get_linked_keys(from_key):
    • get links:key/to_entity/ids
    • get-each collections:to_entity/[id]/key
  • is_linked_to(from_key,to_key):
    • get links:key/to_entity/ids
    • get-until collections:to_entity/[id]/key == to_key

Other ideas

What if instead of using collections and ids we used multiple bitmaps One per 8 byte segment and then answer membership questions via iterating checking all bitmaps Would require a length indicator to avoid collisions with longer keys...

  • 56 bits and 8 for key length? Maximum key size of 255... which would be 37 bitmaps
  • 55 bits and 9 for key length? Maximum key size of 512... which would be 75 bitmaps
  • 54 bits and 10 for key length? Maximum key size of 1024... which would be 151 bitmaps
  • 48 bits and 16 for key length? Maximum key size of 65535... which would be 10923 bitmaps Probably susceptible to horrible regressive bitmap behaviour... unless keys are mostly the same length and have high adjacency.

What if we used a tree for this? Solves the sparse bitmap problem and the length indicator... How to persist? rpds? serde + Vec?

  • bincode - 10 bytes per unique byte added
  • msgpack - 4 bytes per unique byte added
  • custom bitmap hashkey serializer? worst case 2 bytes per unique byte added
    • [1 magic byte|32 key bytes|32 match bytes|...children_in_ascending_order]
    • switch to bitmap when you hit 31 length prefixed entries?
    • magic byte describes both key bytes and match bytes (list or bitmap)

graphlite's People

Contributors

markosindustries avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.