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

Develop minimal plan for exposing MatchingContext over FFI. #68

Open
alilleybrinker opened this issue Feb 24, 2021 · 4 comments
Open

Develop minimal plan for exposing MatchingContext over FFI. #68

alilleybrinker opened this issue Feb 24, 2021 · 4 comments
Labels
4-points Sprint points (4 = moderately easy) A-ffi Area: Foreign Function Interface C-preparation Category: We need to prepare or learn more before doing something T-matching-fns Topic: Exposing inner matching functions over FFI
Projects
Milestone

Comments

@alilleybrinker
Copy link

This is part of #67


MatchingContext is a type used for all the individual matching functions, and we want users to be able to call those functions over FFI, so we need to have some plan to expose it. Unfortunately, it's big and complicated, so I am inclined to come up with a minimal set of things we can expose to make the relevant functions callable, and then come back and enhance how much we're exposing in the future.

This issue is tracking the development of that plan. Once we have a plan, we can consider this resolved and open a new issue.

@alilleybrinker alilleybrinker added A-ffi Area: Foreign Function Interface 4-points Sprint points (4 = moderately easy) C-preparation Category: We need to prepare or learn more before doing something T-matching-fns Topic: Exposing inner matching functions over FFI labels Feb 24, 2021
@alilleybrinker alilleybrinker added this to the March 2021 milestone Feb 24, 2021
@alilleybrinker alilleybrinker added this to To do in March 2021 Feb 24, 2021
@alilleybrinker
Copy link
Author

alilleybrinker commented Mar 16, 2021

Looking at things in more detail:

The first question is how to permit construction of MatchingContext. Thankfully, we've already exposed PactSpecification over FFI, and DiffConfig is a simple enum we can also expose. So we can start by exposing the two most basic constructors: MatchingContext::default and MatchingContext::with_config. However, neither of these has any matching rules associated with them, so they're not useful.

So then we'll need to expose MatchingRuleCategory. Similar, this has some basics that can be done first. MatchingRuleCategory::empty and MatchingRuleCategory::equality are both easy to do up front. MatchingRuleCategory::from_json and MatchingRuleCategory::add_rules_from_json are a possibility, and requires RuleLogic, which is just a simple enum, easy to expose. With those, and some other accessor methods and things, I think we can have our basics covered.

So the very first pass gives us:

  • Expose RoleLogic
  • Expose DiffConfig
  • Expose MatchingContext::default
  • Expose MatchingContext::with_config
  • Expose MatchingRuleCategory::empty
  • Expose MatchingRuleCategory::equality
  • Expose MatchingRuleCategory::rule_from_json
  • Expose MatchingRuleCategory::add_rules_from_json

@alilleybrinker
Copy link
Author

Started implementation of this, but for some reason cbindgen isn't running. Trying to upgrade cbindgen to the latest version is stalling out with network issues, which after an hour I haven't resolved. I'll come back to it on Monday.

@alilleybrinker
Copy link
Author

Still haven't resolved my cbindgen issues, but I'm forging ahead with the code regardless.

@alilleybrinker
Copy link
Author

This work is happening in the basic_matching_context branch.

@alilleybrinker alilleybrinker modified the milestones: March 2021, April 2021 Apr 6, 2021
@alilleybrinker alilleybrinker added this to To do in April 2021 Apr 6, 2021
@alilleybrinker alilleybrinker removed this from To do in March 2021 Apr 6, 2021
@alilleybrinker alilleybrinker moved this from To do to In progress in April 2021 Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4-points Sprint points (4 = moderately easy) A-ffi Area: Foreign Function Interface C-preparation Category: We need to prepare or learn more before doing something T-matching-fns Topic: Exposing inner matching functions over FFI
Projects
April 2021
  
In progress
Development

No branches or pull requests

1 participant