in azkustoingest/managed.go [111:147]
func (m *Managed) FromFile(ctx context.Context, fPath string, options ...FileOption) (*Result, error) {
props := m.newProp()
file, err, local := prepFileAndProps(fPath, &props, options, ManagedClient)
if err != nil {
return nil, err
}
if !local {
var size int64
var compressionTypeForEstimation ingestoptions.CompressionType
if size = props.Ingestion.RawDataSize; size == 0 {
size, err = utils.FetchBlobSize(fPath, ctx, m.queued.client.HttpClient())
if err != nil {
// Failed fetch blob properties
return nil, err
}
compressionTypeForEstimation = utils.CompressionDiscovery(fPath)
props.Ingestion.RawDataSize = utils.EstimateRawDataSize(compressionTypeForEstimation, size)
} else {
// If user sets raw data size we always want to devide it for estimation
compressionTypeForEstimation = ingestoptions.CTNone
}
// File is not compressed and user says its compressed, raw 10 mb -> do
if !shouldUseQueuedIngestBySize(compressionTypeForEstimation, size) {
res, err := m.streamWithRetries(ctx, func() io.Reader { return generateBlobUriPayloadReader(fPath) }, props, true)
if err != nil || res != nil {
return res, err
}
}
return m.queued.fromFile(ctx, fPath, []FileOption{}, props)
}
// No need to get local file size as we later use the compressed stream size
return m.managedStreamImpl(ctx, file, props)
}