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

Candidate/2.8.x #17

Merged
merged 8 commits into from
Jan 15, 2021
Merged

Candidate/2.8.x #17

merged 8 commits into from
Jan 15, 2021

Conversation

bmeike
Copy link
Contributor

@bmeike bmeike commented Jan 11, 2021

Preliminary candidate for the 2.8.x release

@bmeike bmeike requested review from pasin and borrrden January 11, 2021 23:51
/**
* Unrecognized replication state.
*/
UNKNOWN
Copy link
Member

Choose a reason for hiding this comment

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

Would it be prudent here to define this in such a way as it is not the "next status after busy" but rather something like -1 or 999? That would defend against the case where for some reason another status is added in LiteCore that needs to map to the value after busy.

Copy link
Contributor Author

@bmeike bmeike Jan 12, 2021

Choose a reason for hiding this comment

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

If I understand what you are saying, it doesn't work like that. These things don't have values... they just are typed values. I could put UNKNOWN at the other end (before STOPPED).

FWIW, though, you can't do something like BUSY + 1.... They aren't fancy names for integers.

Copy link
Contributor

@pasin pasin Jan 12, 2021

Choose a reason for hiding this comment

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

As a specific LiteCore version / commit will be used, what is the cause to get UNKNOWN status? I think, if there is a new LiteCore status, we should map the status to the ActivityLevel (Public API) correctly.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see...

Copy link
Contributor Author

@bmeike bmeike Jan 12, 2021

Choose a reason for hiding this comment

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

I thought about this a lot, before I did it, @pasin . You could convince me, though, to revert to throwing an exception.

I think, though, that it is quite reasonable to believe (purely abstractly, now) that there might be times at which the bindings cannot determine the replicators state. It seem quite reasonable, to me, to report an unknown instead of making something up.

In our current implementation, users will never see the UNKNOWN state. After some consideration, though, I think it is not unreasonable to think that they might.

Copy link
Contributor

Choose a reason for hiding this comment

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

The platform ActivityLevel's values needs to be mapped with the C4ReplicatorActivityLevel's values.

If the ActivityLevel's value cannot be mapped (e.g. C4ReplicatorActivityLevel introduces a new value), the platform code needs to be fixed to map it correctly or the API needs to be changed to include a new enum value. There shouldn't be an unknown state unless we have a bug.

In our current implementation, users will never see the UNKNOWN state. After some consideration, though, I think it is not unreasonable to think that they might.

Then we shouldn't include it in the public API. This is more like the implementation detail that somehow the platform enum values are not matched with the LiteCore's enum values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Per Pasin, any unrecognized Core state is now reported as "BUSY".

Copy link
Member

Choose a reason for hiding this comment

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

This was more to prevent any accidents like with the stopping status, but BUSY vs UNKNOWN I don't much care. LiteCore also defaults to BUSY now, so this is just an extra layer of protection.

@bmeike
Copy link
Contributor Author

bmeike commented Jan 12, 2021

@bmeike bmeike requested a review from borrrden January 14, 2021 00:54
@bmeike
Copy link
Contributor Author

bmeike commented Jan 14, 2021

Added one more commit: changes to AbstractReplicatorConfiguration to make ReplicatorType visible from Kotlin.

/**
* Unrecognized replication state.
*/
UNKNOWN
Copy link
Contributor

Choose a reason for hiding this comment

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

The platform ActivityLevel's values needs to be mapped with the C4ReplicatorActivityLevel's values.

If the ActivityLevel's value cannot be mapped (e.g. C4ReplicatorActivityLevel introduces a new value), the platform code needs to be fixed to map it correctly or the API needs to be changed to include a new enum value. There shouldn't be an unknown state unless we have a bug.

In our current implementation, users will never see the UNKNOWN state. After some consideration, though, I think it is not unreasonable to think that they might.

Then we shouldn't include it in the public API. This is more like the implementation detail that somehow the platform enum values are not matched with the LiteCore's enum values.

@bmeike bmeike merged commit 136faa8 into android/release/hydrogen Jan 15, 2021
@bmeike bmeike deleted the candidate/2.8.x branch January 15, 2021 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants