Skip to content

Conversation

@Aflynn50
Copy link
Contributor

@Aflynn50 Aflynn50 commented Mar 26, 2025

Remove the GetRelationDetailsForUnit method. Callsites of this method can be replaced by a call to GetRelationDetails which will return the same contents. This method was added to replace the 3.6 function getRelationUnit in the uniter facade which fetched the unit and relation separately. In the callsites replaced in this PR, the unit information was not used anyway, so the GetRelationDetails function can be swapped in.

The only hitch was that GetRelationDetails took a relation ID rather than a relation UUID, whereas GetRelationDetailsForUnit took a unit UUID and a relation UUID. Since it would take an extra facade call to get the relation ID For this reason I changed GetRelationDetails to use a UUID instead of an ID. This means that the existing facade calls in the uniter facade now need to resolve their relation ID into a relation UUID. I settled on this solution rather than resolving the UUID into an ID because we are generally moving towards using the UUIDs in the facades.

Checklist

  • Code style: imports ordered, good names, simple structure, etc
  • Comments saying why design decisions were made
  • Go unit tests, with comments saying what you're testing
  • Integration tests, with comments saying what you're testing
  • doc.go added or updated in changed packages

QA steps

Unit tests pass

Links

Jira card: JUJU-7701

@jujubot jujubot added the 4.0 label Mar 26, 2025
@Aflynn50 Aflynn50 force-pushed the remove-get-unit-relation-details branch from 8e6d9c8 to a931fd9 Compare March 31, 2025 08:31
@Aflynn50 Aflynn50 marked this pull request as ready for review March 31, 2025 08:42
Copy link
Contributor

@gfouillet gfouillet left a comment

Choose a reason for hiding this comment

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

Looks good overall, yet I have a small concern before approval.

// - [relationerrors.RelationNotFound] is returned if the relation UUID
// is not found.
GetRelationDetails(ctx context.Context, relationID int) (relation.RelationDetailsResult, error)
GetRelationDetails(ctx context.Context, relationUUID corerelation.UUID) (relation.RelationDetailsResult, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

👏

@Aflynn50 Aflynn50 force-pushed the remove-get-unit-relation-details branch from a931fd9 to d56b40c Compare April 1, 2025 15:45
@Aflynn50 Aflynn50 requested a review from gfouillet April 1, 2025 15:45
Copy link
Contributor

@gfouillet gfouillet left a comment

Choose a reason for hiding this comment

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

Thanks.

@Aflynn50 Aflynn50 force-pushed the remove-get-unit-relation-details branch from d56b40c to f5b2dad Compare April 2, 2025 09:36
@Aflynn50 Aflynn50 force-pushed the remove-get-unit-relation-details branch from f5b2dad to 0f09795 Compare April 2, 2025 10:00
@Aflynn50
Copy link
Contributor Author

Aflynn50 commented Apr 2, 2025

/merge

@jujubot jujubot merged commit 16fa6f3 into juju:main Apr 2, 2025
20 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants