Skip to content

Conversation

@hmlanigan
Copy link
Member

@hmlanigan hmlanigan commented Mar 25, 2025

The uniter facade method WatchUnitRelations now uses the relation domain service rather than state.

Two new watchers have been implemented in the relation service: WatchLifeSuspendedStatus and WatchPrincipalLifeSuspendedStatus. Both watch multiple namespaces and as well as having individual mappers. Functionality from the now defunct SubordinateRelationsWatcher has been reimplemented in the WatchPrincipalLifeSuspendedStatus.

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

Links

Jira card: JUJU-

The SubordinateRelationWatcher has been deleted. The functionality will
now live in the relation domain's WatchPrincipalLifeSuspendedStatus
method.
One is for principal units, the other for subordinates.

WatchPrincipalLifeSuspendedStatus implements the logic of the former
uniter facade SubordinateRelationsWatcher.
for _, change := range changes {
relUUID := corerelation.UUID(change.Changed())

changedRelationData, err := s.st.WatchLifeSuspendedStatusMapperData(ctx, relUUID, applicationID)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
changedRelationData, err := s.st.WatchLifeSuspendedStatusMapperData(ctx, relUUID, applicationID)
changedRelationData, err := s.st.WatchLifeSuspendedStatusMapperData(ctx, relUUID, applicationID)

That's starting to read like JavaBeanFactoryVistor...

Comment on lines +598 to +599
eventsource.NamespaceFilter(lifeTableName, changestream.All),
eventsource.NamespaceFilter(suspendedTableName, changestream.All),
Copy link
Member

Choose a reason for hiding this comment

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

Should these not be predicate watchers based on the application ID?

Comment on lines +708 to +709
eventsource.NamespaceFilter(lifeTableName, changestream.All),
eventsource.NamespaceFilter(suspendedTableName, changestream.All),
Copy link
Member

Choose a reason for hiding this comment

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

Same here...

@sinanawad
Copy link
Contributor

@hmlanigan is this PR dead? should it be closed?
If not, please update it with a comment. Thank you.

@hmlanigan
Copy link
Member Author

Closing as a POC, and split into multiple PRs.

@hmlanigan hmlanigan closed this Apr 7, 2025
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