Skip to content

Support recursive option and limits when getting activities#756

Merged
asfgit merged 9 commits intoapache:masterfrom
ahgittin:rest-entity-activities-recursive
Jul 22, 2017
Merged

Support recursive option and limits when getting activities#756
asfgit merged 9 commits intoapache:masterfrom
ahgittin:rest-entity-activities-recursive

Conversation

@ahgittin
Copy link
Copy Markdown
Contributor

@ahgittin ahgittin commented Jul 5, 2017

See ActivityApi and EntityApi where this adds better support for recursive task fetching, and an optional limit query parameter with default of 200 tasks; long lists of tasks are painful in the UI and on the server. Recursive task call also has optional maxDepth (default unlimited).

This affects backwards compatibility if clients expect all tasks to be returned from these expensive calls, but they shouldn't.

Pagination

This does not go so far as to support pagination but that would not be hard and we should start thining about it. One strategy I like is to have two optional parameters, itemToContinueAfter and countToContinueAfter, as follows, assuming the data is A, B, C.

Obvious things:

  • request limit=1 and itemToContinueAfter=B: gives [C]
  • request limit=1 and countToContinueAfter=2: gives [C]

If A is deleted:

  • request limit=1 and itemToContinueAfter=B: gives [C]
  • request limit=1 and countToContinueAfter=2: gives []

If A is present but B is deleted:

  • request limit=1 and itemToContinueAfter=B: gives [A] (restarts if item is missing)
  • request limit=1 and countToContinueAfter=2: gives []

If both item and count are supplied we use item if it is present, otherwise we use count. This lets clients do well when working with a changing list, paging forwards will continue from the previous item, never skipping anything unless that previous item was deleted in which rare case it skips some some but it doesn't completely restart.

(Are there better strategies? The benefit here is that it is simple for both client and server.)

@ahgittin
Copy link
Copy Markdown
Contributor Author

ahgittin commented Jul 6, 2017

retest this please

@ahgittin ahgittin changed the title Support recursive option when getting activities Support recursive option and limits when getting activities Jul 6, 2017
@ahgittin
Copy link
Copy Markdown
Contributor Author

ahgittin commented Jul 7, 2017

weird unrelated build failure at https://builds.apache.org/job/brooklyn-server-pull-requests/2396/console, new container location project had a dependency on jclouds 2.0.2 but other things were using 2.0.1 cc @grkvlt -- can't see why, poms look okay

retest this please

@ahgittin
Copy link
Copy Markdown
Contributor Author

ahgittin commented Jul 7, 2017

another unrelated failure org.apache.brooklyn.util.pool.BasicPoolTest.testConcurrentCallsNeverHaveSameVal

retest this please

}


public static void dumpInfo(Task<?> t) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor (and not for this PR): we should probably move this stuff into a separate Dumper utility class, rather than Entities and Tasks being a dumping ground for lots of stuff.

@asfgit asfgit merged commit ca9efdb into apache:master Jul 22, 2017
asfgit pushed a commit that referenced this pull request Jul 22, 2017
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