maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #12387
Re: MDEV-21829: Unique class: interface changes
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
References