Open PD-Pramila opened 1 year ago
Thanks. That's true, I checked that. But it will not consider the metadata value, during find aggregate and queries in that search, right?
What we want to achieve is , for each key-value pair, have a ref count. I thought if I can save that as part of metadata, instead of value, then updates will be fast. It will just update the metadata and not the entire value of the key on disk. Is that understanding right? Then we can query all keys with ref count as zero and do some processing, instead of searching value part for all keys and then filter where ref count is zero.
Any idea how to achieve it?
Can you also explain how to use it, if I have to use from Badger DB. I am using store.TxInsert(...), which internally calls, Txn.Set., where it calls NewEntry and SetEntry. I want to use all encoding and other stuff done in store.TxInsert. Now if this is the way to add metadata, while creating new entry: e := badger.NewEntry([]byte("answer"), []byte("42")).WithMeta(byte(1)).WithTTL(time.Hour) err := txn.SetEntry(e)
How to add metadata and TTL while using TxInsert? Is there any way to do it during TxInsert or after it, before committing Txn?
If you want to find content based on meta data stored in keys, I am not sure but I would suspect that the meta data is actually stored in the vlog anyways.
@tauraamui Thanks for your comments. Can you please answer my prev question: How to add metadata and TTL while using TxInsert of badgerhold? Is there any way to do it during TxInsert or after it, before committing Txn?
I don't know if you can do this with Badgerhold, I doubt it.
yep, you should definitely use kvs.
This thread hasn't referred to KVS, what?
@timshannon @tauraamui What is KVS?
We need TTL and metadata with badgerhold DB, any plans for that?
You can access the badger DB yourself with
store.Badger()
and set TTL and metadata:https://dgraph.io/docs/badger/get-started/#setting-time-to-live-ttl-and-user-metadata-on-keys