SwayDB v0.6 released with Extension API


#1

Hey all, in v0.6 the extensions API allows us to extend the database’s default APIs. Extension in this release enables us to easily create nested Maps similar to Tables in SQL databases.

Here is a sample api on how 2 nested maps can be created under a rootMap.

rootMap
  .maps //access the maps API for rootMap
  .put(key = 1, value = "map 1") //add a child map1 to rootMap
  .flatMap {
    map1 => 
      map1
        .maps //access the maps API for map1
        .put(key = 2, value = "map 2") //add a child map2 to map1
  }

The similar can also be achieved using for comprehension.

Extensions can also be used to implement other data structures like Queue[T], List[T], Stack[T], SQL API etc. Implementing the Queue[T] extension could provide similar features to Kafka (minus the distribution side of things) but with a much simpler and richer API - just like scala’s mutable.Queue[T]().

One thing I’m researching on is automatically creating & dropping inverted indexes during runtime by analysing data access patterns therefore making management of database indexes automatic. The same applies to automatically tuning the database during runtime. Please let me know if you have any suggestions.

Any feedback or suggestions would be very helpful.

Cheers,
Simer