Skip to content

Ads-Client: Refactors build_memory and matches parity between sqlite databases - #7778

Draft
thesuzerain wants to merge 2 commits into
mainfrom
Ads-Client-refactor-builder_memory
Draft

thesuzerain wants to merge 2 commits into
mainfrom
Ads-Client-refactor-builder_memory

Conversation

@thesuzerain

@thesuzerain thesuzerain commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator
  • Removes build_memory in factor of defaulting to in-memory databases and allowing .database(path) to be passed
  • Matches parity between AdsStore and HttpCache for functionality like (former) build_memory and open_db
  • Flattens adsstore/httpstore generation in client.rs to not branch into multiple builders.

Should be no breaking changes (though obviously httpcache is 'touched', and should be covered by tests).

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

.as_ref()
.map(|x| x.db_path.clone())
.unwrap_or(IN_MEMORY_DB_PATH.to_string());
let default_cache_ttl = Duration::from_secs(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This solution is a little bit uglier than the previous in that its more LoC (when formatted, at least), and the repeated cache_config.as_ref()

But its flatter and does not require multiple builders (as it would if you do if let Some(config) = config or some other uglier workarounds.

Another option I elected against was adding a Default implementation for AdsCacheConfig- which clears out the need for the repeated .cache_config.as_ref(), but since we have a non-optional field it feels like a bit of a smell (and I prefer keeping that field mandatory.

I can also revert it to the former logic which is essentially:

if let Some(config) = config {
    // calculate defaults
   let x = default_x_y_z;
   Builder::builder().with().arguments()
} else {
   Builder::builder().default().if().no().config().passed()
}

This branch has not been deployed

No deployments
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.

1 participant