-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement KIP-204 : DeleteRecords API (#969)
* Implement KIP-202 : DeleteRecords API When doing stream processing, it is convinient to use "transient" topic : * retention time is infinite * records get deleted when consumed The java kafka streams client is using the deleteRecords of the admin client to perform this operation. It is lacking in aiokafka The KIP reference https://cwiki.apache.org/confluence/display/KAFKA/KIP-204+%3A+Adding+records+deletion+operation+to+the+new+Admin+Client+API refs #967 * Use common method to get metadata * Explain the unpacking catch all * Remove usage of TaggedFields TaggedFields doesn't seem to work properly at the moment. Maybe they should be replaced by an implementation closer to the java client with their "flexibleVersions" * Fix linting errors (format) * Add change log --------- Co-authored-by: Vincent Maurin <vincent.maurin@checkstep.com> Co-authored-by: Denis Otkidach <denis.otkidach@gmail.com>
- Loading branch information
1 parent
f8d0d15
commit 82695b0
Showing
8 changed files
with
238 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Implement DeleteRecords API (KIP-204) (pr #969 by @vmaurin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from .client import AIOKafkaAdminClient | ||
from .new_partitions import NewPartitions | ||
from .new_topic import NewTopic | ||
from .records_to_delete import RecordsToDelete | ||
|
||
__all__ = ["AIOKafkaAdminClient", "NewPartitions", "NewTopic"] | ||
__all__ = ["AIOKafkaAdminClient", "NewPartitions", "NewTopic", "RecordsToDelete"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class RecordsToDelete: | ||
"""A class for deleting records on existing topics. | ||
Arguments: | ||
before_offset (int): | ||
delete all the records before the given offset | ||
""" | ||
|
||
def __init__( | ||
self, | ||
before_offset, | ||
): | ||
self.before_offset = before_offset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters