-
Notifications
You must be signed in to change notification settings - Fork 236
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
add is_crdt convenience fn #1081
add is_crdt convenience fn #1081
Conversation
-spec is_crdt(riak_object:riak_object()) -> boolean(). | ||
is_crdt(RObj) -> | ||
Bucket = riak_object:bucket(RObj), | ||
case riak_core_bucket:get_bucket(Bucket) of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the case
statement and not just:
BProps = riak_core_bucket:get_bucket(Bucket),
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda stole most of this from https://github.com/basho/riak_kv/blob/feature/zl/helper-fn-check-if-object-bucket-props-supports-crdt/src/riak_kv_crdt.erl#L103 haha, which probably has it just for the guard. But, you're right, the case is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at other spots, e.g.
Line 163 in ec7e525
-spec consistent_object(binary() | {binary(),binary()}) -> true | false | {error,_}. |
Looks good to me, although a unit test wouldn't hurt. |
Yeah... I'm basically testing it for the use-case here, https://github.com/basho/yokozuna/pull/452/files#diff-a765b250cdc4d78ac1eef6cfddbbb280R508, but I'll add a unit test. |
Thanks, I think a unit test here is needed. Just something simple, meck out riak_core_bucket and return buckets for all the datatypes, some datatype=nonsense, and some no datatype is exhaustive. |
f00820d
to
6638df3
Compare
6638df3
to
9f17bcc
Compare
👍 9f17bcc |
…ect-bucket-props-supports-crdt add is_crdt convenience fn Reviewed-by: seancribbs
@borshop merge |
Convenience fun related to @seancribbs's comment on basho/yokozuna#452 (diff). If there's a better name for this fun, I'll update it accordingly :).