// Check verifies that an event is valid.
336610
func (sc ServiceCheck) Check() error {
	if len(sc.Name) == 0 {
		return fmt.Errorf("statsd.ServiceCheck name is required")
	}
	if byte(sc.Status) < 0 || byte(sc.Status) > 3 {
		return fmt.Errorf("statsd.ServiceCheck status has invalid value")
	}
	return nil
}
1113289
func (tu *thresholdUpdater) Check() error {
	tu.mu.Lock()
	defer tu.mu.Unlock()

	if tu.count >= tu.threshold {
		return tu.status
	}

	return nil
}
827271
func (c certificate) Check(d *certdata.Data) *errors.Errors {
	var e = errors.New(nil)

	for _, cc := range c {
		if cc.filter != nil && !cc.filter.Check(d) {
			continue
		}
		e.Append(cc.f(d))
	}

	return e
}
1362769
func Check(err error, checker func(error) bool) bool {
	if annotated, ok := err.(*annotatedError); ok {
		return checker(annotated.LastError())
	}
	return checker(err)
}
1103678
func (la *LoginAttempt) Check() error {
	if la.Time.IsZero() {
		return trace.BadParameter("missing parameter time")
	}
	return nil
}
36383
func (m *SafeMap) Check(k interface{}) bool {
	m.lock.RLock()
	defer m.lock.RUnlock()
	if _, ok := m.bm[k]; !ok {
		return false
	}
	return true
}
1216920
func (u *updater) Check() error {
	u.mu.Lock()
	defer u.mu.Unlock()

	return u.status
}
559234
func Check(err error) {
	if err != nil {
		log.Fatalf("%+v", errors.WithStack(err))
	}
}
211970
func (s *GrblStreamer) Check(m *vm.Machine) (err error) {
	defer func() {
		if r := recover(); r != nil {
			err = errors.New(fmt.Sprintf("%s", r))
		}
	}()
	gen := export.GrblGenerator{}
	gen.Init()
	gen.Write = func(string) {}
	export.HandleAllPositions(m, &gen)
	return nil
}
1141745
func checkValid(data []byte, scan *scanner) error {
	scan.reset()
	for _, c := range data {
		scan.bytes++
		if scan.step(scan, int(c)) == scanError {
			return scan.err
		}
	}
	if scan.eof() == scanError {
		return scan.err
	}
	return nil
}
1079046
func (fn FilterFunc) Check(rls *rspb.Release) bool {
	if rls == nil {
		return false
	}
	return fn(rls)
}
1248021
func ValidateEvent(eventCategory EventCategory, event Event) bool {
	valid := false
	switch eventCategory {
	case EventCategoryDefined:
		valid = int(event) >= 0 && event < EventDefinedLast
	case EventCategoryUndefined:
		valid = int(event) >= 0 && event < EventUndefinedLast
	case EventCategoryStarted:
		valid = int(event) >= 0 && event < EventStartedLast
	case EventCategorySuspended:
		valid = int(event) >= 0 && event < EventSuspendedLast
	case EventCategoryResumed:
		valid = int(event) >= 0 && event < EventResumedLast
	case EventCategoryStopped:
		valid = int(event) >= 0 && event < EventStoppedLast
	case EventCategoryShutdown:
		valid = int(event) >= 0 && event < EventShutdownLast
	case EventCategoryPmsuspended:
		valid = int(event) >= 0 && event < EventPMSuspendedLast
	}

	return valid
}
1180464
func (c *healthCheck) Check() (warnings, errors []error) {
	if err := c.f(c.client); err != nil {
		return nil, []error{err}
	}
	return nil, nil
}
1163443
func (f *ResourceFilter) Check(n *NodeInfo) bool {
	if f.reservations.NanoCPUs > n.AvailableResources.NanoCPUs {
		return false
	}

	if f.reservations.MemoryBytes > n.AvailableResources.MemoryBytes {
		return false
	}

	for _, v := range f.reservations.Generic {
		enough, err := genericresource.HasEnough(n.AvailableResources.Generic, v)
		if err != nil || !enough {
			return false
		}
	}

	return true
}
565237
func Check(ex pkix.Extension, d *certdata.Data) *errors.Errors {
	var e = errors.New(nil)

	// If the cert type isn't one of the `allowedCertTypes`, return an error
	if _, allowed := allowedCertTypes[d.Type]; !allowed {
		e.Err(certTypeErr)
	}

	// Per RFC 7633 "The TLS feature extension SHOULD NOT be marked critical"
	if ex.Critical {
		e.Err(critExtErr)
	}

	// Check that the extension value is the expected slice of DER encoded ASN.1
	if bytes.Compare(ex.Value, expectedExtensionValue) != 0 {
		e.Err(extValueErr)
	}

	return e
}
930438
func (m *SocketEvent_Write) Validate() error {
	if m == nil {
		return nil
	}

	{
		tmp := m.GetData()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return SocketEvent_WriteValidationError{
					field:  "Data",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	// no validation rules for EndStream

	return nil
}
1064897
func (e AuthService) Check() (bool, error) {
	url := "/authentication"

	resp, err := e.client.MakeRequest(
		"GET",
		url,
		0,
		nil,
	)
	if err != nil {
		return false, err
	}
	defer resp.Body.Close()

	switch resp.StatusCode {
	case http.StatusOK:
		return true, nil
	case http.StatusUnauthorized:
		fallthrough
	case http.StatusForbidden:
		return false, nil
	default:
		return false, e.client.handleUnexpectedResponse(resp)
	}
}