Skip to content

Commit

Permalink
improve godocs
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed May 14, 2019
1 parent cb423f4 commit f4d9eee
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ type Validator func(context.Context, peer.ID, *Message) bool
// ValidatorOpt is an option for RegisterTopicValidator.
type ValidatorOpt func(addVal *addValReq) error

// validation represents the validator pipeline
// validation represents the validator pipeline.
// The validator pipeline performs signature validation and runs a
// sequence of user-configured validators per-topic. It is possible to
// adjust various concurrency parameters, such as the number of
// workers and the max number of simultaneous validations. The user
// can also attach inline validators that will be executed
// synchronously; this may be useful to prevent superfluous
// context-switching for lightweight tasks.
type validation struct {
p *PubSub

Expand Down Expand Up @@ -344,6 +351,10 @@ func WithValidateThrottle(n int) Option {

// WithValidateWorkers sets the number of synchronous validation worker goroutines.
// Defaults to NumCPU.
//
// The synchronous validation workers perform signature validation, apply inline
// user validators, and schedule asynchronous user validators.
// You can adjust this parameter to devote less cpu time to synchronous validation.
func WithValidateWorkers(n int) Option {
return func(ps *PubSub) error {
if n > 0 {
Expand Down

0 comments on commit f4d9eee

Please sign in to comment.