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

feat: rework response types to use interface and allow user to pass []byte or string messages to a topic #72

Merged
merged 10 commits into from
Feb 1, 2023

Conversation

eaddingtonwhite
Copy link
Member

No description provided.

incubating/cache_response.go Outdated Show resolved Hide resolved
incubating/cache_response.go Outdated Show resolved Hide resolved
incubating/cache_response.go Outdated Show resolved Hide resolved
@eaddingtonwhite eaddingtonwhite changed the title feat: allow user to pass []byte or string messages to a topic feat: rework response types to use interface and allow user to pass []byte or string messages to a topic Jan 31, 2023
Copy link
Contributor

@kvcache kvcache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a few things. I am still not a go person though, so definitely tap someone else for a more detailed review of best practices and design patterns!

incubating/cache_requests.go Outdated Show resolved Hide resolved
incubating/cache_response.go Outdated Show resolved Hide resolved
incubating/cache_response.go Outdated Show resolved Hide resolved
incubating/subscription.go Outdated Show resolved Hide resolved
internal/models/responses.go Outdated Show resolved Hide resolved
Text: request.Value,
switch request.Value.(type) {
case string:
_, err := client.unaryGrpcClient.Publish(ctx, &pb.XPublishRequest{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pb "github.com/momentohq/client-sdk-go/internal/protos"

this makes this line unnecessarily hard to understand

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree. I need to look at how were generating the proto stubs again. I think maybe we can rework this to stop IDE from wanting us to do import alias like this. I can play with it some more and do follow up pr.

internal/services/pubsub_data_service.go Outdated Show resolved Hide resolved
internal/services/pubsub_data_service.go Outdated Show resolved Hide resolved
internal/services/pubsub_data_service.go Outdated Show resolved Hide resolved
momento/simple_cache_client.go Outdated Show resolved Hide resolved
@cprice404
Copy link
Contributor

Sorry @eaddingtonwhite I haven't had a chance to look at this earlier. Today I reviewed it in the github UI but still haven't had time to pull it down and play with it in an IDE.

So far I am on board with all of @kvcache 's suggestions. Do we have a path forward that we're all on the same page about or are there any particular things you need more 👀 on?

Copy link
Contributor

@kvcache kvcache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking a lot better. I have 1 remaining UX question

Comment on lines +29 to +30
Key interface{}
Value interface{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seem not great, and like a footgun to the user. Any reason not to use type momento.Bytes interface { isBytes() } and struct RawBytes + struct StringBytes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes totally. was thinking about this as well after this pr and iteration on types. I was going to add to this PR last night but this is getting so big already I was thinking could make this change in a follow up PR. Probably ok for this PR since that functionality is not changing today from where it was. That work for you? can tag u in follow up pr also.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A follow up for this sounds great!

Comment on lines +37 to 40
// CacheGetHit Hit Response to a cache Get api request.
type CacheGetHit struct {
Value []byte
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is nice

@eaddingtonwhite
Copy link
Member Author

No I think this is gtg @cprice404 im in alignment w/ @kvcache also I think have all changes we want in for now. I want to make the one more change to CacheGet Key and Body that we were talking in follow up pr though since this is getting so large. So if I can get final 👍 from either you or @kvcache will merge this one now I think should be gtg.

Copy link
Contributor

@kvcache kvcache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Topic types look good to me. I like the new safe types direction and am looking forward to seeing the request types for plain scalars become explicit about their supported types and intents too.

@eaddingtonwhite eaddingtonwhite merged commit 896ef56 into main Feb 1, 2023
@eaddingtonwhite eaddingtonwhite deleted the feat/handle-byte-string-msgs branch February 1, 2023 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants