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

Expand to a full range of parameters for TopicSpec #527

Closed
digikata opened this issue Dec 10, 2024 · 3 comments
Closed

Expand to a full range of parameters for TopicSpec #527

digikata opened this issue Dec 10, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@digikata
Copy link
Contributor

allow size specification et al from Python client
enhance create topic to allow optional spec

@digikata
Copy link
Contributor Author

digikata commented Dec 10, 2024

Currently creation of a topic spec is very limited, or you can create a topic with default

def topic_partition_create(topic: str):
    admin = FluvioAdmin.connect()

    # create
    paritions = 3
    replication = 1
    topic_spec = TopicSpec.new_computed(paritions, replication, False)

    dry_run = False
    admin.create_topic_spec(topic, dry_run, topic_spec)

It would be nicer to expose at least all the parameters that fluvio topic create supports:

def topic_partition_create(topic: str):
    admin = FluvioAdmin.connect()

    topic_spec = TopicSpec.new() # default spec
    topic_spec.storage("1Gb")
    topic_spec.retention_sec(3600)
    topic_spec.segment_size("10M")
    # ... etc

    # make the create_topic(...) call a little more pythonic
    admin.create_topic(topic) # creates with default spec
    admin.create_topic(topic, topic_spec) # creates topic with more complex spec

Reference

$ fluvio topic create -h    
Create a Topic with the given name

fluvio topic create [OPTIONS] [name]

Arguments:
  [name]  The name of the Topic to create

Options:
  -p, --partitions <partitions>         The number of Partitions to give the Topic [default: 1]
  -r, --replication <integer>           The number of full replicas of the Topic to keep [default: 1]
  -i, --ignore-rack-assignment          Ignore racks while computing replica assignment
  -f, --replica-assignment <file.json>  Replica assignment file
  -m, --mirror-apply <file.json>        Mirror apply file
      --mirror                          Flag for a mirror topic
  -d, --dry-run                         Validates configuration, does not provision
      --retention-time <time>           Retention time (round to seconds) Ex: '1h', '2d 10s', '7 days' (default)
      --segment-size <bytes>            Segment size (by default measured in bytes) Ex: `2048`, '2 Ki', '10 MiB', `1 GB`
      --compression-type <compression>  Compression configuration for topic
      --max-partition-size <bytes>      Max partition size (by default measured in bytes) Ex: `2048`, '2 Ki', '10 MiB', `1 GB`
  -c, --config <PATH>                   Path to topic configuration file
      --home-to-remote                  signify that this topic can be mirror from home to edge
  -h, --help                            Print help (see more with '--help')

https://docs.rs/fluvio/latest/fluvio/metadata/topic/struct.TopicSpec.html

@digikata digikata added the enhancement New feature or request label Dec 10, 2024
@digikata
Copy link
Contributor Author

digikata commented Dec 10, 2024

@digikata
Copy link
Contributor Author

TopicSpec fixed w/ #528, allows creation of topics with a full range of parameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants