func enoughBytesForBenchmark(objectServer *objectclient.ObjectClient, request sub.FetchRequest) bool { lengths, err := objectServer.CheckObjects(request.Hashes) if err != nil { return false } var totalLength uint64 for _, length := range lengths { totalLength += length } if totalLength > 1024*1024*64 { return true } return false }
func writeObjects(objectClient *objectclient.ObjectClient, hashes []hash.Hash, inums []uint64, lengths []uint64, inodesDir string) error { objectsReader, err := objectClient.GetObjects(hashes) if err != nil { return errors.New(fmt.Sprintf("Error getting object reader: %s\n", err.Error())) } for index, hash := range hashes { err = writeObject(objectsReader, hash, inums[index], lengths[index], inodesDir) if err != nil { return err } } return nil }