Skip to content

Commit 27ca560

Browse files
committed
backing up
1 parent 7282c66 commit 27ca560

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/saluki/main.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
_LISTEN = "listen"
1313
_CONSUME = "consume"
14+
_REPLAY = "replay"
1415

1516

1617
def main() -> None:
@@ -66,13 +67,38 @@ def main() -> None:
6667
consumer_mode_parser.add_argument("-s", "--schema", required=False, default="auto", type=str)
6768
consumer_mode_parser.add_argument("-g", "--go-forwards", required=False, action="store_true")
6869
consumer_mode_parser.add_argument("-p", "--partition", required=False, type=int, default=0)
70+
# TODO make this allow multiple comma-split args
71+
consumer_mode_parser.add_argument("-f", "--filter", required=False, type=str, nargs='+')
6972

7073
listen_parser = sub_parsers.add_parser(
7174
_LISTEN,
7275
help="listen mode - listen until KeyboardInterrupt",
7376
parents=[parent_parser, consumer_parser],
7477
)
7578
listen_parser.add_argument("-p", "--partition", required=False, type=int, default=None)
79+
# TODO make filtering work for this as well
80+
81+
#### NEW FEATURES HERE PLZ
82+
# replay from, to offset
83+
# saluki replay -o FROMOFFSET TOOFFSET srcbroker/srctopic destbroker/desttopic
84+
85+
# replay from, to timestamp
86+
# saluki replay -t FROMTIMESTAMP TOTIMESTAMP srcbroker/srctopic destbroker/desttopic
87+
88+
# saluki consume x messages of y schema
89+
# saluki consume -f pl72 mybroker:9092/XXX_runInfo -m 10 # get the last pl72 run starts
90+
91+
# saluki consume x messages of y or z schema
92+
# saluki consume -f pl72,6s4t mybroker:9092/XXX_runInfo -m 10 # get the last pl72 run starts or 6s4t run stops
93+
94+
replay_parser = sub_parsers.add_parser(
95+
_REPLAY,
96+
help="replay mode - replay data into another topic",
97+
parents=[parent_parser],
98+
)
99+
replay_parser.add_argument("-o", "--offset", help="replay between offsets", type=bool, required=False, default="store_false")
100+
replay_parser.add_argument("-t", "--timestamp", help="replay between timestamps", type=bool, required=False)
101+
76102

77103
if len(sys.argv) == 1:
78104
parser.print_help()
@@ -98,7 +124,8 @@ def main() -> None:
98124
args.offset,
99125
args.go_forwards,
100126
)
101-
127+
elif args.command == _REPLAY:
128+
pass
102129

103130
if __name__ == "__main__":
104131
main()

0 commit comments

Comments
 (0)