-
Notifications
You must be signed in to change notification settings - Fork 35
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
Using string or map or JSON object as a value for a key. #31
Comments
Initially we planned to build this into the library, but it turns out all of our use cases so far have been satisfied with this simpler API.
side := make(map[uint64]YourOwnStruct) Then, you place your data into this side structure, and then insert the data into vellum, with the value being the key into your side structure. Later if you look up something in vellum, it returns to you the key in your side structure when you can find the rest of the data. Hope this helps. |
I guess, I will go the second route… What I wanted to is to filter the results using the iterator based on conditions applied to the bitmask in the value field.
From: Marty Schoch <notifications@github.com>
Sent: wtorek, 21 lipca 2020 19:49
To: couchbase/vellum <vellum@noreply.github.com>
Cc: Pawel Urbanski <pawel@pawelurbanski.com>; Author <author@noreply.github.com>
Subject: Re: [couchbase/vellum] Using string or map or JSON object as a value for a key. (#31)
Initially we planned to build this into the library, but it turns out all of our use cases so far have been satisfied with this simpler API.
1. If you're going to persist the vellum to disk anyway, you can persist your other data structures first, and then when you build the vellum, the uint64 value you assign to the keys is simply the file offset of your other more complex data-structure. This is how bleve's file format zap does things. We first persist the roaring bitmap data-structures to disk (things we want to be the value we can lookup in vellum) Then when we insert into vellum, we associate the file offsets of those data-structures (uint64) with the keys. Then later when we use vellum for a lookup, we take the uint64, and use it to find the roaring bitmaps elsewhere in the file. This is very convenient if you plan to mmap the file anyway.
2. If you're not persisting this to disk, and working with it purely in memory, then you could simply keep another map along side the vellum instance, and you can make the key to your map be the uint64 you associate with the vellum key. For example:
side := make(map[uint64]YourOwnStruct)
Then, you place your data into this side structure, and then insert the data into vellum, with the value being the key into your side structure. Later if you look up something in vellum, it returns to you the key in your side structure when you can find the rest of the data.
Hope this helps.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#31 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAWAEQCB2QSY7CFKWMAHGKLR4XIJNANCNFSM4PD2RPKA>.
|
Dear Team,
Is it possible to assign a string / map / JSON object to a key? The documentation and examples speak of uint64.
If not, is it possible to get an index to the key that uniquely points to the key as a kind of hash / pointer one could use as a key in a map to attach some more metadata to the key that just an integer value available by default?
Thanks for any hints...
The text was updated successfully, but these errors were encountered: