Skip to content

Indexes 3: Adds flatbuffers schema and SolverPackageSpec for indexes to spk#1338

Open
dcookspi wants to merge 14 commits intoindex-2-new-unchecked-additionsfrom
index-3-flatbuffer-and-solver-package-spec
Open

Indexes 3: Adds flatbuffers schema and SolverPackageSpec for indexes to spk#1338
dcookspi wants to merge 14 commits intoindex-2-new-unchecked-additionsfrom
index-3-flatbuffer-and-solver-package-spec

Conversation

@dcookspi
Copy link
Copy Markdown
Collaborator

@dcookspi dcookspi commented Mar 19, 2026

Note: for info on benefits of indexing for spk solves see #1340 (5 of 5). Maybe start there and work back down to this PR if you prefer to review PRs top down.

This adds a new spk-proto crate to spk, and a new v0 package implementation: SolverPackageSpec. spk-proto contains a flatbuffers schema for index package, version, build, options, and global variables data. The flatbuffers schema is designed for solver use. It only stores data needed for solving with the packages. It is not a complete replacement for all package operations. It does not have enough data to build or test packages.

SolverPackageSpec is a package implementation backed by a flatbuffer. Those packages will be produced from an index by changes added in a subsequent PR (#1339, 4 of 5). The functions for converting spk schema objects into and out of flatbuffer objects are contained in fb_converter.rs.

This is one of the changes that supports adding indexes and index based packages to Spk repositories.

This is 3 of 5 chained PRs for adding indexes to spk solves:

  1. Indexes 1: Change Package and related traits to not return references to fields #1336
  2. Indexes 2: Add new_unchecked() constructors to spk schema objects #1337
  3. this PR
  4. Indexes 4: Adds Indexes for SPK repositories #1339
  5. Indexes 5: Adds spk repo index subcommand for index generation and updates #1340
  6. Indexes 6: Changes version_filter field in index schema #1344

@dcookspi dcookspi self-assigned this Mar 19, 2026
@dcookspi dcookspi added enhancement New feature or request SPI AOI Area of interest for SPI pr-chain This PR doesn't target the main branch, don't merge! labels Mar 19, 2026
@@ -0,0 +1,327 @@
// Copyright (c) Contributors to the SPK project.
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 flatbuffer schema does not match the rust spk schema objects one-to-one. The focus is on in making an index that is useful for spk solvers. There is not enough data in the index schema to build or run tests on any of the packages. There is only enough to run solves on them.

Some of the tables have the same name as their rust counterparts, others do not. Some are flatbuffer specific. Some do not store all the fields of their rust counter part. The ones not stored are noted as 'ignored' in comments. Some of the objects have been flattened down to include pieces of intermediate or more deeply nested rust objects. Those should also be noted in comments.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 19, 2026

@dcookspi dcookspi requested a review from rydrman March 20, 2026 00:41
@dcookspi dcookspi force-pushed the index-3-flatbuffer-and-solver-package-spec branch from 47ea722 to af8dcc2 Compare March 20, 2026 19:29
@dcookspi dcookspi requested a review from jrray March 20, 2026 22:39
@dcookspi dcookspi force-pushed the index-2-new-unchecked-additions branch from d83388a to a59523b Compare March 25, 2026 00:56
@dcookspi dcookspi force-pushed the index-3-flatbuffer-and-solver-package-spec branch from af8dcc2 to 53f24d1 Compare March 25, 2026 01:07
@dcookspi dcookspi force-pushed the index-2-new-unchecked-additions branch 2 times, most recently from 5c8e4db to 33938c3 Compare March 27, 2026 00:54
@dcookspi dcookspi force-pushed the index-3-flatbuffer-and-solver-package-spec branch from 53f24d1 to cb733cd Compare March 27, 2026 19:09
#[derive(Debug, Clone, Hash, Eq, PartialEq, Ord, PartialOrd, Serialize)]
#[serde(tag = "api")]
#[enum_dispatch(Deprecate, DeprecateMut)]
#[allow(clippy::large_enum_variant)]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe I missed this before, but we don't want to allow this. You can avoid it by Boxing the IndexedPackage.

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.

I've done this. I had to box both of the entries because of the size differences between them and the Boxed object itself.

dcookspi added 14 commits April 7, 2026 12:21
…kage data.

Adds v0 SolverPackageSpec as a package implementation backed by a flatbuffer.

Adds fb_converter functions for converting spk schema objects into and
out of flatbuffer objects.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
schema. Moves flatc-rust to workspace Cargo.toml for spk and spfs.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
package list to the index.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
…kage

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
…cated check during index generation.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
differences, removes some unnecessary unsafe keywords.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
@dcookspi dcookspi force-pushed the index-3-flatbuffer-and-solver-package-spec branch from acf608d to d47df82 Compare April 7, 2026 20:23
@dcookspi dcookspi requested a review from jrray April 7, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pr-chain This PR doesn't target the main branch, don't merge! SPI AOI Area of interest for SPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants