Skip to content
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

[improve][client] PIP-229: Add a common interface to get fields of the MessageIdData #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BewareMyPower
Copy link
Owner

@BewareMyPower BewareMyPower commented Jan 28, 2023

TODO:

  • Remove BatchMessageAcker.
  • Add tests for customized message ID implementations. See here

@BewareMyPower BewareMyPower force-pushed the bewaremypower/pip-229-msg-id-adv branch from 3ac0ce6 to f9d7ad6 Compare January 28, 2023 12:03
@BewareMyPower BewareMyPower changed the title [refactor][client] PIP-229: Add a common interface to get fields of the MessageIdData [improve][client] PIP-229: Add a common interface to get fields of the MessageIdData Jan 28, 2023
@BewareMyPower BewareMyPower force-pushed the bewaremypower/pip-229-msg-id-adv branch 4 times, most recently from bf14ea8 to 34fa858 Compare February 1, 2023 10:34
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@fa6af43). Click here to learn what that means.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #19   +/-   ##
=========================================
  Coverage          ?   63.46%           
  Complexity        ?    25850           
=========================================
  Files             ?     1822           
  Lines             ?   133142           
  Branches          ?    14673           
=========================================
  Hits              ?    84497           
  Misses            ?    40892           
  Partials          ?     7753           
Flag Coverage Δ
inttests 24.77% <0.00%> (?)
systests 25.71% <0.00%> (?)
unittests 60.71% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

@BewareMyPower BewareMyPower force-pushed the bewaremypower/pip-229-msg-id-adv branch from bb7e64e to fdd32c0 Compare February 3, 2023 04:00
@BewareMyPower BewareMyPower force-pushed the bewaremypower/pip-229-msg-id-adv branch 2 times, most recently from f02339d to 6d1f61b Compare February 14, 2023 02:25
@BewareMyPower BewareMyPower force-pushed the bewaremypower/pip-229-msg-id-adv branch 2 times, most recently from 2270912 to 6863357 Compare February 21, 2023 09:25
@BewareMyPower BewareMyPower force-pushed the bewaremypower/pip-229-msg-id-adv branch from 6863357 to 476e7e8 Compare March 6, 2023 12:11
…ssageIdData

Master issue: apache#18950

### Motivation

We need a common interface to get fields of the MessageIdData. After
that, we won't need to assert a MessageId implementation is an instance
of a specific class. And we can pass our customized MessageId
implementation to APIs like `acknowledge` and `seek`.

### Modifications

- Add `MessageIdAdv` to get fields of `MessageIdData`, make all
  MessageId implementations inherit it (except `MultiMessageIdImpl`).
- Add `MessageIdAdvUtils` for the most common used methods.
- Replace `BatchMessageAcker` with the `BitSet` for ACK.
- Remove `TopicMessageIdImpl#getInnerMessageId` since a
  `TopicMessageIdImpl` can be treated as its underlying `MessageId`
  implementation now.
- Remove `instanceof BatchMessageIdImpl` checks in `pulsar-client`
  module by casting to `MessageIdAdv`.

After this refactoring, the 3rd party library will no longer need to
cast a `MessageId` to a specific implementation. It only needs to cast
`MessageId` to `MessageIdAdv`. Users can also implement their own util
class so the methods of `MessageIdAdvUtils` are all not public.

### Verifications

Add `CustomMessageIdTest` to verify a simple MessageIdAdv implementation
that only has the (ledger id, entry id, batch idx, batch size) fields
also works for seek and acknowledgment.
@BewareMyPower BewareMyPower force-pushed the bewaremypower/pip-229-msg-id-adv branch from 476e7e8 to 64185ac Compare March 15, 2023 08:02
@github-actions
Copy link

The pr had no activity for 30 days, mark with Stale label.

@github-actions github-actions bot added the Stale label Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants