opensearch-project / opensearch-sdk-java

OpenSearch SDK to build and run extensions
Apache License 2.0
28 stars 58 forks source link

[META] Implement Extension Points #315

Open dbwiddis opened 1 year ago

dbwiddis commented 1 year ago

This issue is created to track Extension Point implementation.

Not all extension points will need to be implemented for Extensions, and will be removed from the list when that determination is made.

The general approach to implementation is:

  1. Create a FooExtension interface corresponding to the FooPlugin interface, with the same default implementations.
  2. During initialization, communicate which interfaces an Extension implements to OpenSearch
  3. Review existing functionality, usually implemented in the Node class that runs on OpenSearch bootstrap, where a module iterates over plugins implementing a particular interface and and "registers" the implemented extensions points, adding them to maps/lists, etc.
  4. Determine whether functionality is primarily local to the extension (the easy case) or integral to OpenSearch (which requires serializing and deserializing via Writable interface) and implement appropriately. For example:
    • NamedXContent is local to an extension. The static initializers from OpenSearch are created and no transport communication actually happens.
    • RestHandlers are integrated with the OpenSearch RestController. The handled methods and paths must be communicated over transport to OpenSearch to be registered. This is done using Strings.
    • Settings are integrated with OpenSearch. The settings must be turned into a Writeable object to be sent over transport, and re-created on the other end. This is done using the WriteableSetting class.

Extension Points applicable to all plugins are defined in the Plugin interface:

The following interfaces also implement custom functionality:

dbwiddis commented 1 year ago

We don't have a create components method, and instead are directly implementing the required components. Some are associated with other extension points.

The following are part of createComponents and are significant enough to be tracked separately as part of that extension point:

Extensions which interact with Job Scheduler will need JobSchedulerExtension extension points. These are being implemented in the job-scheduler repository.

dbwiddis commented 1 year ago

The following plugins may not be relevant for extensions. They are documented here for completeness:

minalsha commented 1 year ago

@dbwiddis why are https://github.com/opensearch-project/opensearch-sdk-java/issues/315#issuecomment-1377742853 not relevant for extensions?

dbwiddis commented 1 year ago

why are #315 (comment) not relevant for extensions?

@minalsha I used the qualifier "may not be relevant". I'd appreciate another set of eyes on this (@saratvemulapalli).

minalsha commented 1 year ago

List of prioritized and ranked Extension Points, we want to go after are as follows: