Andrew Wong has posted comments on this change. Change subject: util: add Status::AndThen combinator ......................................................................
Patch Set 3: (2 comments) http://gerrit.cloudera.org:8080/#/c/7399/3//COMMIT_MSG Commit Message: PS3, Line 9: The AndThen combinator makes it easier to chain together : Status-returning operations when failure recovery is something other : than returning early. RETURN_NOT_OK already handles the return-early : case elegantly. I think my confusion stemmed from expecting failure recovery to take more of an or_else shape. Maybe note somewhere that the intent to replace this: Status SequenceOfStatuses() { RETURN_NOT_OK(S1) RETURN_NOT_OK(S2) RETURN_NOT_OK(S3) return Status::OK() } do_stuff(SequenceOfStatuses()) with this: Status s = S1->AndThen(S2)->AndThen(S3) do_stuff(s) Although I suppose we get the bonus of not having to compile a new SequenceOfStatuses() function. Actually, is chaining a bunch of small lambdas more costly to compile than one large one (e.g. if SequenceOfStatuses were a lambda)? http://gerrit.cloudera.org:8080/#/c/7399/3/src/kudu/util/status.h File src/kudu/util/status.h: PS3, Line 187: ok() In case of very long chains, should we PREDICT_TRUE? And in CloneAndPrepend? -- To view, visit http://gerrit.cloudera.org:8080/7399 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia6e1a79ff95406825d4238a8157d242252562805 Gerrit-PatchSet: 3 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Dan Burkert <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Andrew Wong <[email protected]> Gerrit-Reviewer: Dan Burkert <[email protected]> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Tidy Bot Gerrit-Reviewer: Todd Lipcon <[email protected]> Gerrit-HasComments: Yes
