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

Upgrade prost-types and support type conversion in both directions #106

Closed
ashlineldridge opened this issue Nov 10, 2024 · 2 comments
Closed

Comments

@ashlineldridge
Copy link

ashlineldridge commented Nov 10, 2024

Hi, I would like to use quanta however it's version constraint of prost-types prevents me from being able to convert from an Instant to prost_types::Timestamp due to the version constraint as my code is using version 0.13 of prost and prost-types which contains a number of fixes and improvements. Would you be open to updating? There is this very old PR to upgrade to 0.12 but I would like to bump to 0.13. I can raise a PR if you like.

@ashlineldridge
Copy link
Author

Additionally, is there any reason only conversion from quanta::Instant to prost_types::Timestamp is supported and not also the reverse? My use case is that I'm using Prost to create a bidirectional gRPC streaming server and I want to be able to use standard gRPC timestamps on the wire but I want to use the quanta::Instance type in my domain code and so I need to convert in both directions.

Would you be open to supporting this? I have forked and implemented the conversion in this commit.

@ashlineldridge ashlineldridge changed the title Upgrade prost-types from 0.11 to 0.13 Upgrade prost-types and support type conversion in both directions Nov 10, 2024
@tobz
Copy link
Member

tobz commented Nov 11, 2024

Would you be open to supporting this? I have forked and implemented the conversion in this commit.

quanta::Instant is meant to mirror std::time::Instant insofar as it's opaque and only relevant on the system where the instant is measured. In that vein, the continued support for serializing to prost_types::Timestamp is actually an oversight on my part. It should have been removed when we removed support for Instant::as_u64.

I would recommend switching to std::time::SystemTime if you need a way to hold, and transport, wall-clock time across the process boundary.

@tobz tobz closed this as completed Nov 11, 2024
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

No branches or pull requests

2 participants