[Maria-developers] MDEV-21829: Unique class: discussion followup part #2
Hello Igor, Trying to capture the input from the last call. Currently class Unique is using RB-Tree for its in-memory storage. RB-Tree is implemented by struct TREE and tree_XXX() functions (further I'll refer to them both as just "TREE"). It is possible to get Unique to use some other data structure for its in-memory storage. The most obvious candidate is a hash table. (There are currently no plans to do this, though). So, your request was that - An interface is developed for in-memory storage (let's refer to it as Unique::MemStorage) - An implementation of this interface is developed that uses TREE. (We can't change the TREE itself as it is used in multple places). Is this really the intent? Please clarify. My reaction is that the above described change does not seem to have any relevance to MDEV-21829. MDEV-21829 is about supporting variable-length keys, not about changing, or preparing to change Unique::MemStorage. BR Sergei -- Sergei Petrunia, Software Developer MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog
Hello again, Again, taking notes about the input of the last call. The question raised was the interface of the Unique class. == Before the patch == - Unique object stores elements of the same size. - The size is passed in the constructor - unique_add has the key as a parameter: class Unique { Unique( ... uint size_arg, ... ); ... bool unique_add(void *ptr); } == In the current patch == The length is passed as the second argument. class Unique { ... bool unique_add(void *ptr, uint size_arg); } == The desired change == - Keep the unique_add()'s signature intact. - Unique::Unique() should receive a parameter that describes the data format used. class Unique { Unique(..., KeyFormatDescriptor descr, ... ) bool unique_add(void *ptr); } Here, KeyFormatDescriptor can be one of: * KeyFixedSizeFormatDescriptor(N) - a value that specifies that keys will be fixed-size entities taking N bytes each. * KeyVariableSizeFormatDescriptor - a value that specifies that keys will be variable-size. KeyVariableSizeFormatDescriptor::get_size is a function: size_t KeyVariableSizeFormatDescriptor::get_size(void *ptr) which allows the Unique to find out the size of the passed key. Any objections to this? BR Sergei -- Sergei Petrunia, Software Developer MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog
participants (1)
-
Sergey Petrunia