HomeMesosphereNo notifications. 4 unresolved issues.

Reverted the `group` function to not use `transitiveGroupsById`.
ClosedAll Users

Authored by mpark on Dec 12 2016, 7:21 PM.

Diff Detail

Repository
rMARATHON marathon
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mpark retitled this revision from to Reverted the `group` function to not use `transitiveGroupsById`..Dec 12 2016, 7:21 PM
mpark updated this object.
mpark edited the test plan for this revision. (Show Details)
mpark added a subscriber: marathon-team.
aquamatthias edited reviewers, added: timcharper; removed: jeschkies.Dec 12 2016, 8:02 PM
timcharper accepted this revision.Dec 12 2016, 8:31 PM
timcharper added inline comments.
src/main/scala/mesosphere/marathon/state/Group.scala
47

I’m finding this code quite difficult to parse. Can we add some documentation to how the method works?

This revision is now accepted and ready to land.Dec 12 2016, 8:31 PM
timcharper added inline comments.Dec 12 2016, 9:07 PM
src/main/scala/mesosphere/marathon/state/Group.scala
47

how about this?

/**
  * Find and return the child group for the given path. If no match is found, then returns None
  */
def group(gid: PathId): Option[Group] = {
  if (id == gid) Some(this)
  else {
    val immediateChild = gid.restOf(id).root
    groupsById.find { case (_, group) => group.id.restOf(id).root == immediateChild }
      .flatMap { case (_, group) => group.group(gid) }
  }
}

Please use tim's suggestion

timcharper updated this revision to Diff 1240.Dec 12 2016, 9:57 PM

Add docs. Clarify naming.

This revision was automatically updated to reflect the committed changes.