api/outlier_report.go
func (a *API) FetchOutlierReport(cid CIDType) (*OutlierReport, error) {
	if cid == nil || *cid == "" {
		return nil, fmt.Errorf("Invalid outlier report CID [none]")
	}

	reportCID := string(*cid)

	matched, err := regexp.MatchString(config.OutlierReportCIDRegex, reportCID)
	if err != nil {
		return nil, err
	}
	if !matched {
		return nil, fmt.Errorf("Invalid outlier report CID [%s]", reportCID)
	}

	result, err := a.Get(reportCID)
	if err != nil {
		return nil, err
	}

	if a.Debug {
		a.Log.Printf("[DEBUG] fetch outlier report, received JSON: %s", string(result))
	}

	report := &OutlierReport{}
	if err := json.Unmarshal(result, report); err != nil {
		return nil, err
	}

	return report, nil
}
func (a *API) FetchOutlierReport(cid CIDType) (*OutlierReport, error) {
	if cid == nil || *cid == "" {
		return nil, fmt.Errorf("Invalid outlier report CID [none]")
	}

	reportCID := string(*cid)

	matched, err := regexp.MatchString(config.OutlierReportCIDRegex, reportCID)
	if err != nil {
		return nil, err
	}
	if !matched {
		return nil, fmt.Errorf("Invalid outlier report CID [%s]", reportCID)
	}

	result, err := a.Get(reportCID)
	if err != nil {
		return nil, err
	}

	if a.Debug {
		a.Log.Printf("[DEBUG] fetch outlier report, received JSON: %s", string(result))
	}

	report := &OutlierReport{}
	if err := json.Unmarshal(result, report); err != nil {
		return nil, err
	}

	return report, nil
}
func ( a * API ) FetchOutlierReport ( cid CIDType ) ( * OutlierReport , error ) { if cid == nil || * cid == " " { return nil , fmt . Errorf ( " " ) } reportCID := string ( * cid ) matched , err := regexp . MatchString ( config . OutlierReportCIDRegex , reportCID ) if err != nil { return nil , err } if ! matched { return nil , fmt . Errorf ( " " , reportCID ) } result , err := a . Get ( reportCID ) if err != nil { return nil , err } if a . Debug { a . Log . Printf ( " " , string ( result ) ) } report := & OutlierReport { } if err := json . Unmarshal ( result , report ) ; err != nil { return nil , err } return report , nil }
// FetchOutlierReport retrieves outlier report with passed cid.
FetchOutlierReport retrieves outlier report with passed cid .