Skip to content

Metadata new api#407

Open
adespawn wants to merge 5 commits intoscylladb:mainfrom
adespawn:metadata-new-api
Open

Metadata new api#407
adespawn wants to merge 5 commits intoscylladb:mainfrom
adespawn:metadata-new-api

Conversation

@adespawn
Copy link
Copy Markdown
Contributor

@adespawn adespawn commented Mar 9, 2026

After some discussion with @wprzytula, we have decided that the existing API for the metadata is not worth keeping.
The problems with the DSx API are described in #261.

This PR is first part of replacing existing metadata API.
With this PR I introduce new / updated classes for tables, keyspace and materialized views. Those classes replace (non*) existing versions from the DSx driver.

* for keyspace class

Refs: #261, #70

@adespawn adespawn added this to the 0.5.0 milestone Mar 9, 2026
@adespawn adespawn self-assigned this Mar 9, 2026
@Lorak-mmk
Copy link
Copy Markdown

The problems with the DSx API are described in #268.

I see no such description (or any comment) in the linked issue

@adespawn
Copy link
Copy Markdown
Contributor Author

Linked wrong issue, should have been #261

@adespawn adespawn force-pushed the metadata-new-api branch 2 times, most recently from f23a235 to 6f94563 Compare March 20, 2026 11:03
@adespawn adespawn requested a review from Copilot March 20, 2026 11:07
@adespawn adespawn marked this pull request as ready for review March 20, 2026 11:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR begins replacing the existing metadata API by introducing new/updated metadata model types for tables, materialized views, and keyspaces, along with corresponding TypeScript definitions.

Changes:

  • Reworks table metadata modeling (adds ColumnKind / ColumnMetadata, changes TableMetadata shape and exports).
  • Updates materialized view metadata to inherit from the new table metadata model.
  • Introduces keyspace replication strategy/keyspace metadata model and updates TS typings; removes the old DataCollection abstraction.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
lib/metadata/table-metadata.js Replaces the old table metadata class with new column/table modeling and changes module exports.
lib/metadata/materialized-view.js Switches materialized view to extend the new TableMetadata.
lib/metadata/keyspace-metadata.js Adds new keyspace metadata + replication strategy model.
lib/metadata/index.d.ts Adds TS types for the new metadata model (columns, table, keyspace strategy).
lib/metadata/data-collection.js Removes legacy DataCollection base class.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@adespawn adespawn requested a review from wprzytula March 23, 2026 14:10
adespawn and others added 5 commits March 30, 2026 17:15
This API is a 1:1 mapping of the Table metadata exported by the rust driver.

The goal of those classes without constructors is to provide type definition,
visible and understandable for users. Metadata objects can be initialized
with object construction syntax (ex. {partitionKey: ['id']})
and returned from type annotated functions, without any penalty for lack
of constructors.
This API is a 1:1 mapping of the Materialized View metadata exported by the rust driver.

The goal of those classes without constructors is to provide type definition,
visible and understandable for users. Metadata objects can be initialized
with object construction syntax (ex. {partitionKey: ['id']})
and returned from type annotated functions, without any penalty for lack
of constructors.
This API is a 1:1 mapping of the Keyspace metadata exported by the rust driver.
This includes a Strategy class used in the keyspace metadata.

The goal of those classes without constructors is to provide type definition,
visible and understandable for users. Metadata objects can be initialized
with object construction syntax (ex. {partitionKey: ['id']})
and returned from type annotated functions, without any penalty for lack
of constructors.
This was used as a Base class for Materialized View and Tables metadata
that is no longer used.
@adespawn adespawn requested a review from wprzytula March 30, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants