Skip to content

[elixir] feat: Allow comment and custom_properties on create_database#597

Open
nicolazar wants to merge 1 commit into
apache:mainfrom
nicolazar:feat/elixir-create-database-descriptor
Open

[elixir] feat: Allow comment and custom_properties on create_database#597
nicolazar wants to merge 1 commit into
apache:mainfrom
nicolazar:feat/elixir-create-database-descriptor

Conversation

@nicolazar
Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #587

Brief change log

This PR allows callers to set a database comment and custom_properties when creating a database, via an optional Fluss.DatabaseDescriptor:

descriptor =
  Fluss.DatabaseDescriptor.new()
  |> Fluss.DatabaseDescriptor.comment("App data")
  |> Fluss.DatabaseDescriptor.put_custom_property("owner", "team-x")

:ok = Fluss.Admin.create_database(admin, "my_db", descriptor)

Previously admin_create_database hard-coded the descriptor to None, so the only way to observe a descriptor was to read one back via get_database_info/2 (#586). This closes that gap on the write side.

We now change the create_database function to accept a descriptor as the third positional argument, before ignore_if_exists.

Tests

Added unit tests for the builder helpers (happy paths, overwrites, cross-field preservation, guard/validation failures) and integration tests for create_database/3 with a descriptor (comment-only, properties-only, struct-directly), asserting the values round-trip through get_database_info/2.

Additionally, strengthened the existing get_database_info/2 test to assert descriptor values rather than just shape.

API and Format

The signature of admin create_database/3 function has been changed: previously it meant create_database(admin, name, ignore_if_exists). It now means create_database(admin, name, descriptor). Callers that passed ignore_if_exists positionally as the third argument must move it to the fourth. The three in-repo callers have been updated.

Thread an optional DatabaseDescriptor through Fluss.Admin.create_database
so callers can set a database comment and custom properties at creation
time.
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.

[elixir] Allow setting custom properties when creating a database

1 participant