Skip to content

Conversation

@timsaucer
Copy link
Member

Which issue does this PR close?

None

Rationale for this change

This is continuation of work in the FFI crate to expose useful traits. We currently have FFI catalog, schema, and table providers. The next layer up in the heirarchy is the catalog provider list.

What changes are included in this PR?

  • Implement FFI_CatalogProviderList
  • Add unit tests and integration tests
  • Minor rearrangement of integration test for catalog

Are these changes tested?

Yes, included in PR.

Are there any user-facing changes?

This is only new addition to the FFI crate. No existing code is modified except making one data member pub(crate)

@github-actions github-actions bot added the ffi Changes to the ffi crate label Nov 12, 2025
Copy link
Member

@martin-g martin-g left a comment

Choose a reason for hiding this comment

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

Few more naming suggestions

#[allow(non_camel_case_types)]
pub struct FFI_CatalogProviderList {
/// Register a catalog
pub register_catalog: unsafe extern "C" fn(
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pub register_catalog: unsafe extern "C" fn(
pub register_catalog_provider: unsafe extern "C" fn(

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this one should remain as is because it mirrors the CatalogProviderList trait function naming.

pub register_catalog: unsafe extern "C" fn(
&Self,
name: RString,
catalog: &FFI_CatalogProvider,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
catalog: &FFI_CatalogProvider,
catalog_provider: &FFI_CatalogProvider,

Copy link
Member Author

Choose a reason for hiding this comment

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

Same, mirrors the CatalogProviderList definition.

) -> ROption<FFI_CatalogProvider>,

/// List of existing catalogs
pub catalog_names: unsafe extern "C" fn(&Self) -> RVec<RString>,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pub catalog_names: unsafe extern "C" fn(&Self) -> RVec<RString>,
pub catalog_provider_names: unsafe extern "C" fn(&Self) -> RVec<RString>,

pub catalog_names: unsafe extern "C" fn(&Self) -> RVec<RString>,

/// Access a catalog
pub catalog:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pub catalog:
pub catalog_provider:

names.into_iter().map(|s| s.into()).collect()
}

unsafe extern "C" fn register_catalog_fn_wrapper(
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
unsafe extern "C" fn register_catalog_fn_wrapper(
unsafe extern "C" fn register_catalog_provider_fn_wrapper(

names.into_iter().map(|s| s.into()).collect()
}

unsafe extern "C" fn register_catalog_fn_wrapper(
Copy link
Member

Choose a reason for hiding this comment

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

Or:

Suggested change
unsafe extern "C" fn register_catalog_fn_wrapper(
unsafe extern "C" fn register_provider_fn_wrapper(

@timsaucer
Copy link
Member Author

@martin-g Thank you for the review! Most of those are copy+paste things I didn't catch. I didn't change the recommendations where you were suggesting something that differs from the underlying trait. Maybe we should update the naming there, but honestly feels a bit pedantic. I think the function names here should mirror those in the underlying trait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ffi Changes to the ffi crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants