Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Metadata on keys and then supporting that metadata value to filter search results. #96

Open
PD-Pramila opened this issue Jul 5, 2023 · 9 comments

Comments

@PD-Pramila
Copy link

No description provided.

@timshannon
Copy link
Owner

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

@PD-Pramila
Copy link
Author

PD-Pramila commented Jul 5, 2023

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?

@PD-Pramila
Copy link
Author

PD-Pramila commented Jul 5, 2023

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?

@tauraamui
Copy link

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.

@PD-Pramila
Copy link
Author

@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?

@tauraamui
Copy link

I don't know if you can do this with Badgerhold, I doubt it.

@timshannon
Copy link
Owner

yep, you should definitely use kvs.

@tauraamui
Copy link

This thread hasn't referred to KVS, what?

@PD-Pramila
Copy link
Author

@timshannon @tauraamui What is KVS?

We need TTL and metadata with badgerhold DB, any plans for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants