rosedblabs / rosedb

Lightweight, fast and reliable key/value storage engine based on Bitcask.

Home Page:https://rosedblabs.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal: allow key and value to store per bucket

0x5487 opened this issue · comments

Scenario:
A bucket is just like a table in a database or a collection in MongoDB.
A system has 10 million more records (order) in DB. If we need to find all orders for a user. we probably need to iterate keys to get it. The Get function might be slower in this case.

Proposal:
allow specific a bucket when calling "Put" and "Get" functions. Each bucket has its own index.

func (db *DB) Put(bucket string, key []byte, value []byte) error
func (db *DB) Get(bucket string, key []byte) ([]byte, error)

Unfortunately, this proposal needs to change the record format in the WAL file.

I will consider this feature.