jackdaw
jackdaw copied to clipboard
Review the return types used for operations in the admin ns
Many of the operations in the admin namespace block on some upstream result before transforming the result into something a bit more idiomatic for Clojure programs. If the operation is unable to complete (e.g. it is unable to connect to the configured broker), the operation will never return, potentially blocking your REPL.
Returning a manifold deferred instead allows jackdaw to asynchronously perform the same transformation but instead of returning the transformed object after blocking, immediately return a deferred that eventually resolves to the transformed result.
In addition, functions like create-topics!
currently return a boolean indicating whether all operations were completed. The underlying kafka operations allow us to infer which operations failed and provide representation of this to the caller.
Current jackdaw.admin
Operation | Blocking Operation | Returns |
---|---|---|
list-topics | ListTopicsResult.names | [Str] |
topic-exists? | ListTopicsResult.names | boolean |
retry-exists? | specified by caller | boolean |
create-topics! | CreateTopicsResult.all | boolean |
describe-topics | DescribeTopicsResult.all | {Str topic-metadata?} |
describe-topics-configs | DescribeConfigsResult.all | {Str topic-config?} |
topics-ready? | DescribeTopicsResult.all | boolean |
alter-topic-config! | AlterConfigsResult.all | boolean |
delete-topics! | DeleteTopicsResult.all | boolean |
partition-ids-of-topics | DescribeTopicsResult.all | {Str partition-info?} |
describe-cluster | DescribeClusterResult.all | cluster-result? |
get-broker-config | DescribeConfigsResult.all | config-result? |
Proposed jackdaw.admin
Operation | Blocking Operation | Deferred? | Returns | Comments |
---|---|---|---|---|
list-topics | ListTopicsResult.names | Yes | [Str] | |
topic-exists? | ListTopicsResult.names | Yes | boolean | |
retry-exists? | specified by caller | No | boolean | Unchanged |
create-topics! | CreateTopicsResult.all | Yes | {Str boolean} | boolean -> {Str boolean} |
describe-topics | DescribeTopicsResult.all | Yes | {Str topic-metadata?} | |
describe-topics-configs | DescribeConfigsResult.all | Yes | {Str topic-config?} | |
topics-ready? | DescribeTopicsResult.all | No | boolean | Unchanged |
alter-topic-config! | AlterConfigsResult.all | Yes | {Str boolean} | boolean -> {Str boolean} |
delete-topics! | DeleteTopicsResult.all | Yes | {Str boolean} | boolean -> {Str boolean} |
partition-ids-of-topics | DescribeTopicsResult.all | Yes | {Str partition-info?} | |
describe-cluster | DescribeClusterResult.all | Yes | cluster-result? | |
get-broker-config | DescribeConfigsResult.all | Yes | config-result? |