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

Accept string-based paths in khepri_machine and khepri_tx #73

Merged
merged 2 commits into from
Mar 31, 2022

Conversation

dumbbell
Copy link
Member

This was the case for the "simple API" in khepri only so far. But this is convenient to be able to use string-based paths anywhere. It also improves the consistency of the API.

As a consequence, khepri_path:from_string/1 accepts both string-based and regular paths and returns a regular path. Now unnecessary, khepri_path:maybe_from_string/1 and khepri_path:component_from_string/1 were removed.

khepri_path:component_to_string/1 is still there but made internal. It's not public anymore.

@dumbbell dumbbell added the enhancement New feature or request label Mar 31, 2022
@dumbbell dumbbell self-assigned this Mar 31, 2022
@dumbbell
Copy link
Member Author

I'm thinking of removing that "simple API" vs "advanced API" concept altogether after this patch.

khepri_machine would remain the low-level API to interact with the Ra state machine, but it would be private. khepri would become the only public API. The simplified return values of khepri functions are not straightforward in their current implementation and it would be more practicle to add more functions for simplified return values such as get_value() or get_data(). khepri_tx should expose the same API as khepri as well.

This would make Khepri easier to learn and use, which is my primary goal.

@coveralls
Copy link

coveralls commented Mar 31, 2022

Pull Request Test Coverage Report for Build 466

  • 68 of 69 (98.55%) changed or added relevant lines in 3 files are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.1%) to 86.908%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/khepri_path.erl 49 50 98.0%
Files with Coverage Reduction New Missed Lines %
src/khepri_condition.erl 1 90.09%
src/khepri_path.erl 5 93.22%
Totals Coverage Status
Change from base Build 458: -0.1%
Covered Lines: 1726
Relevant Lines: 1986

💛 - Coveralls

This was the case for the "simple API" in `khepri` only so far. But this
is convenient to be able to use string-based paths anywhere. It also
improves the consistency of the API.

As a consequence, `khepri_path:from_string/1` accepts both string-based
and regular paths and returns a regular path. Now unnecessary,
`khepri_path:maybe_from_string/1` and
`khepri_path:component_from_string/1` were removed.

`khepri_path:component_to_string/1` is still there but made internal.
It's not public anymore.
It is already covered by the previous clause.
@dumbbell dumbbell force-pushed the accept-string-path-in-khepri_machine-and-khepri_tx branch from 01fa16d to c4412eb Compare March 31, 2022 09:18
@dumbbell dumbbell marked this pull request as ready for review March 31, 2022 10:11
@dumbbell dumbbell merged commit b6410b5 into main Mar 31, 2022
@dumbbell dumbbell deleted the accept-string-path-in-khepri_machine-and-khepri_tx branch March 31, 2022 10:11
dumbbell added a commit that referenced this pull request Apr 1, 2022
dumbbell added a commit that referenced this pull request May 2, 2022
This should have been removed as part of #73.
dumbbell added a commit that referenced this pull request May 2, 2022
This should have been removed as part of #73.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants