[Code] distributed Code abstraction#41374
Conversation
|
Pinging @elastic/code |
0f17e2e to
42a21e2
Compare
💚 Build Succeeded |
mw-ding
left a comment
There was a problem hiding this comment.
mostly good. leave some comments for discussions.
x-pack/legacy/plugins/code/server/distributed/handler_adpter.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/code/server/distributed/handler_adpter.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
these refactoring could possibly bring a bunch of conflicts with the new platform migration PR. since you have already done, let's just let it be. But please do not add more refactoring of the existing code now.
There was a problem hiding this comment.
I'm actually not very like the refactoring here, I think those code can be deleted if we use Dependency Injection.
There was a problem hiding this comment.
yes, that could save us from copying/pasting some instances around. let's do it in a separate one maybe after the new platform migration refactoring is done.
There was a problem hiding this comment.
nit: might as well add a logging for non-code-node here.
There was a problem hiding this comment.
Another comment here is that since you have already introduced an adapter layer (CodeNodeAdapter, LocalAdapter), we can just leave the non-code-node logic into the abstraction of the adapter by creating a new adapter for non-code-node (e.g. RemoteHandlerAdapter so that we don't need to have a different initNonCodeNode function here. The init logic in my mind should look like
let adapter = null;
if (code node) {
adapter = new CodeNodeAdapter(...);
} else if (non code node) {
adapter = new RemoteHandlerAdapter(codeNodeUrl, ...)
} else {
adapter = new LocalHandlerAdapter(...);
}
const codeServices = new CodeServices(adapter);
await initCodeNode(..., codeServices, ...)
Hopefully, this is more readable.
There was a problem hiding this comment.
I see that you already have a NonCodeNodeAdapter there, just replace RemoteHandlerAdapter to NonCodeNodeAdapter in the comment above
There was a problem hiding this comment.
In non-code mode, I really don't want to initiate any local resource related code(git queue, etc). That's why initNonCodeNode exists
There was a problem hiding this comment.
nit: implementation -> implement
There was a problem hiding this comment.
nit: a brief comment on that serverHandler will always be null here since it will be overridden by the request forwarding.
There was a problem hiding this comment.
Looks like Endpoint and RequestContext are pretty much the same thing based on this PR. The implementations of toContext() of each endpoints can be moved into their constructors.
There was a problem hiding this comment.
You are right, the endpoint was designed to represent the target kibana node address we are sending to. Here in Local and Multi-node mode, the address is always the same. So, they look like the same thing.
💔 Build Failed |
💚 Build Succeeded |
💔 Build Failed |
💚 Build Succeeded |
mw-ding
left a comment
There was a problem hiding this comment.
LG. We might want to hold merging this PR to master until the 7.3 has been officially released just in case backporting code to 7.3 branch. Also, might need another quick sync on resolving conflicts with the new platform migration PR: #41192 (comment)
💚 Build Succeeded |
💔 Build Failed |
💚 Build Succeeded |
* [Code] distributed Code abstraction
…-or-edit-existing-rollup-job * 'master' of github.com:elastic/kibana: (114 commits) [ML] Fixing empty index pattern list (elastic#42299) [Markdown] Shim new platform - cleanup plugin (elastic#41760) [Code] Enable hierarchicalDocumentSymbolSupport for java language server (elastic#42233) Add New Platform mocks for data plugin (elastic#42261) Http server route handler implementation (elastic#41894) [SR] Allow custom index pattern to be used instead of selectable list when choosing indices to restore (elastic#41534) [Code] distributed Code abstraction (elastic#41374) [SIEM] Sets page titles to the current page you are on (elastic#42157) Saved Objects export API stable type order (elastic#42310) cancellation of interpreter execution (elastic#40238) [SIEM] Fixes a crash when Machine Learning influencers is an undefined value (elastic#42198) Changed the job to work with a dedicated index (elastic#42297) FTR: fix testSubjects.missingOrFail (elastic#42290) Increase retry timeout to prevent flaky tests (elastic#42291) Spaces - make space a hidden saved object type (elastic#41688) Allow applications to register feature privileges which are excluded from the base privileges (elastic#41300) Disable flaky log column reorder test (elastic#42285) Fixing add element in element reducer (elastic#42276) Fix infinite loop (elastic#42228) [Maps][File upload] Remove geojson deep clone logic, handle on maps side (elastic#41835) ...
Summary
https://github.com/elastic/code/issues/1449
Basically, this PR provides an RPC style abstraction layer to dispatch resource-aware request to
How to
define a service definition object like the following:
register it
consuming it
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] This was checked for cross-browser compatibility, including a check against IE11- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers