Skip to content

Add FetchRegistrationEntries API - #5910

Merged
sorindumitru merged 16 commits into
spiffe:mainfrom
faisal-memon:multi-entries
Mar 24, 2025
Merged

sorindumitru merged 16 commits into
spiffe:mainfrom
faisal-memon:multi-entries

Conversation

@faisal-memon

Copy link
Copy Markdown
Contributor

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality

sql store

Description of change

Adds a FetchRegistrationEntries API to fetch multiple select entry IDs. Will be used in a separate PR to batch fetch updated entries with the events based cache.

Which issue this PR fixes

partially addresses #5624

@faisal-memon

Copy link
Copy Markdown
Contributor Author

@sorindumitru This is now ready for review

@sorindumitru sorindumitru self-assigned this Mar 11, 2025
Comment thread pkg/server/datastore/datastore.go Outdated
CreateOrReturnRegistrationEntry(context.Context, *common.RegistrationEntry) (*common.RegistrationEntry, bool, error)
DeleteRegistrationEntry(ctx context.Context, entryID string) (*common.RegistrationEntry, error)
FetchRegistrationEntry(ctx context.Context, entryID string) (*common.RegistrationEntry, error)
FetchRegistrationEntries(ctx context.Context, entryIDs []string) ([]*common.RegistrationEntry, error)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if returning a map wouldn't be a better interface. I think you're likely to be interested in both the found entries and the entries that were not found (no longer in the database).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yea i think so.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This change is in

Comment on lines +2133 to +2162
{
name: "Entries 1, 2, and 3",
entryIDs: []string{createdEntry1.EntryId, createdEntry2.EntryId, createdEntry3.EntryId},
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we also add test for non-existing entries? Looking them up just by themselves and looking them up together with other existing entries.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this one is still not addressed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Change is in

@sorindumitru

Copy link
Copy Markdown
Member

@faisal-memon

Copy link
Copy Markdown
Contributor Author

@sorindumitru All comments addressed and unit tests fixed.

@@ -2662,12 +2666,12 @@ FROM
WHERE registered_entry_id IN (SELECT id FROM listing)

ORDER BY selector_id, dns_name_id

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should also sort bu entry id here and for the MySQL variants.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, done.

@sorindumitru sorindumitru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the contribution @faisal-memon !

faisal-memon and others added 14 commits March 23, 2025 20:03
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Co-authored-by: Sorin Dumitru <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
Signed-off-by: Faisal Memon <[email protected]>
@sorindumitru
sorindumitru merged commit 826a819 into spiffe:main Mar 24, 2025
@faisal-memon
faisal-memon deleted the multi-entries branch March 24, 2025 21:20
@faisal-memon faisal-memon mentioned this pull request Mar 24, 2025
2 of 3 tasks
@MarcosDY MarcosDY added this to the 1.12.1 milestone Apr 7, 2025
sorindumitru pushed a commit that referenced this pull request Apr 19, 2025
Use the new FetchRegistrationEntries API from #5910 to get the full list of updated entries rather than fetching them individually.

Signed-off-by: Faisal Memon <[email protected]>
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.

3 participants