Exclusive WriteableRegistry for plugins/modules/libraries #7840
Labels
discuss
Issues intended to help drive brainstorming and decision making
enhancement
Enhancement or improvement to existing feature or request
Plugins
Is your feature request related to a problem? Please describe.
In #7780 we've introduced support for opensearch modules, plugins or libraries to be able to register their own writer and reader implementations.
There's a concern with ensuring that the class identifier byte be kept unique across all such implementations.
WriteableRegistry::registerReader()
will throw an exception if the ordinal byte used to register the reader already exists for some other reader in the READER_REGISTRY, but we could still register a reader using the same byte as forJodaCompatibleZonedDateTime
from within a static block in Security Plugin and successfully execute the security plugin unit tests. This shall fail during runtime though.Describe the solution you'd like
Have external modules/plugins/libraries to optionally maintain their own
WriteableRegistry
to avoid type ID collision when usingwriteGenericValue
andreadGenericValue
. Reference to this registry can either be passed to StreamInput/StreamOutput constructors or to thewriteGenericValue
,readGenericValue
methods. When passed, the StreamInput/StreamOutput will use this registry instead of the "core" one.As of now
BaseWriteable.WriteableRegistry
is just a utility class with static maps that hold readers/writers. This will need refactoring to support creation of registry objects.Describe alternatives you've considered
Reserving exclusive offsets or byte ranges for each plugin/module type IDs - This won't scale well as we reserve one byte for type ID with 256 possible values only. Further, it'd be counterintuitive wrt the idea of decoupling core from plugins/modules as we'd have to maintain the offset/range information for plugins within core.
relates to #7780
relates to #5910
relates to #7821
The text was updated successfully, but these errors were encountered: