Skip to content

Commit

Permalink
Add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
workanator committed Sep 22, 2017
1 parent e494bb9 commit d566ae4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pred/doc.go
@@ -0,0 +1,24 @@
/*
Package pred provides predicates for basic logic operations.
Predicates with conditional jobs like run.If allows to make non-linear
flow. In terms of floc predicate should return true or false depending
on context.
const idReadyFlag = 100
testReady := func(ctx floc.Context) bool {
if flag := ctx.Value(idReadyFlag); flag != nil {
return flag.(bool)
}
return false
}
flow := run.Sequence(
..., // Some job done here
job.If(testReady, job.Background(writeToDisk)), // Write some data ready to disk in background
..., // Some job more
)
*/
package pred

0 comments on commit d566ae4

Please sign in to comment.