-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Functions] reorganize the context hierarchy for functions #10631
Conversation
@@ -84,7 +84,7 @@ | |||
void flush() throws PulsarClientException; | |||
|
|||
/** | |||
* Flush all the messages buffered in the client and wait until all messages have been successfully persisted. | |||
* Flush all the messages buffered in the client Asynchronously. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. Asynchronously -> asynchronously
*/ | ||
Record<?> getCurrentRecord(); | ||
|
||
@InterfaceStability.Unstable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are changing the InterfaceStability level? Is this change no backwards compatible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I am ok with doing some refactoring in the interfaces we have for Source, Sink, and Function context, this PR also exposes interfaces that are originally only for FunctionContext to SourceContext and SinkContext. We should consider carefully before introducing these new interfaces in Source and Sink Context. I don't want to expose functionality that is not needed.
If this is just a refactor, please keep the current interfaces exposed for FunctionContext, SourceContext, and SinkContext.
@jerrypeng Thanks for the review. Despite the previous shared interfaces, the followings new interfaces are exposed to connectors:
Based on my understanding, these are pulsar cluster interaction methods that connectors may need. And actually, I'm planning to add one more interface But I might be missing some of the context here, so please let me know which of the newly exposed functionality is not needed and we can discuss and update accordingly. |
|
Sounds good to me. I'll limit the scope of this PR for only refactoring apis. Keep those listed apis only in the FunctionContext. And send additional PRs if apis are needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I share @jerrypeng concerns.
Apart from that I appreciate this work.
The fact that we are not changing the tests is a good demonstration that this is a compatible change from the API point of view
@nlu90 Can you rebase the PR to the latest master? |
@sijie I rebased the master. |
Could you take another look at the PR? I've updated it based on the comments and passed all the CI check |
) ### Motivation Currently the context relationship for function, source and sink is not well defined. This prevents some common features to be added once for all and creates some confusion, code duplication in the current repo. As demonstrated in the following graph, this PR changes the hierarchy from left to right. By introducing a common base context, it help solving some issues we are seeing. The base context provides common access to pulsar cluster, state, metrics, and meta-data to make sure all components can reuse it. ![context hierarchy](https://user-images.githubusercontent.com/16407807/118730483-8ebf5200-b7ec-11eb-9220-d41261f148bb.png) ### Modifications - Remove `ConnectorContext` interface. - Introduce a `BaseContext` interface. - Update existing `Context`, `SourceContext`, `SinkContext` interface to extend the new common interface.
) ### Motivation Currently the context relationship for function, source and sink is not well defined. This prevents some common features to be added once for all and creates some confusion, code duplication in the current repo. As demonstrated in the following graph, this PR changes the hierarchy from left to right. By introducing a common base context, it help solving some issues we are seeing. The base context provides common access to pulsar cluster, state, metrics, and meta-data to make sure all components can reuse it. ![context hierarchy](https://user-images.githubusercontent.com/16407807/118730483-8ebf5200-b7ec-11eb-9220-d41261f148bb.png) ### Modifications - Remove `ConnectorContext` interface. - Introduce a `BaseContext` interface. - Update existing `Context`, `SourceContext`, `SinkContext` interface to extend the new common interface.
…12117) ### Motivation Currently the context relationship for function, source and sink is not well defined. This prevents some common features to be added once for all and creates some confusion, code duplication in the current repo. As demonstrated in the following graph, this PR changes the hierarchy from left to right. By introducing a common base context, it help solving some issues we are seeing. The base context provides common access to pulsar cluster, state, metrics, and meta-data to make sure all components can reuse it. ![context hierarchy](https://user-images.githubusercontent.com/16407807/118730483-8ebf5200-b7ec-11eb-9220-d41261f148bb.png) ### Modifications - Remove `ConnectorContext` interface. - Introduce a `BaseContext` interface. - Update existing `Context`, `SourceContext`, `SinkContext` interface to extend the new common interface. Co-authored-by: Neng Lu <nlu@streamnative.io>
) ### Motivation Currently the context relationship for function, source and sink is not well defined. This prevents some common features to be added once for all and creates some confusion, code duplication in the current repo. As demonstrated in the following graph, this PR changes the hierarchy from left to right. By introducing a common base context, it help solving some issues we are seeing. The base context provides common access to pulsar cluster, state, metrics, and meta-data to make sure all components can reuse it. ![context hierarchy](https://user-images.githubusercontent.com/16407807/118730483-8ebf5200-b7ec-11eb-9220-d41261f148bb.png) ### Modifications - Remove `ConnectorContext` interface. - Introduce a `BaseContext` interface. - Update existing `Context`, `SourceContext`, `SinkContext` interface to extend the new common interface.
Motivation
Currently the context relationship for function, source and sink is not well defined. This prevents some common features to be added once for all and creates some confusion, code duplication in the current repo. As demonstrated in the following graph, this PR changes the hierarchy from left to right. By introducing a common base context, it help solving some issues we are seeing. The base context provides common access to pulsar cluster, state, metrics, and meta-data to make sure all components can reuse it.
Modifications
ConnectorContext
interface.BaseContext
interface.Context
,SourceContext
,SinkContext
interface to extend the new common interface.Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changes