Exemple #1
0
func (b *gcsBackend) Open(tx *postgres.DBTx, info FileInfo, txControl bool) (FileStream, error) {
	if txControl {
		// We don't need the database transaction, so clean it up
		tx.Rollback()
	}

	url, err := storage.SignedURL(b.bucketName, info.ExternalID, b.signOpts())
	return newRedirectFileStream(url), err
}
Exemple #2
0
func (b *azureBackend) Open(tx *postgres.DBTx, info FileInfo, txControl bool) (FileStream, error) {
	if txControl {
		// We don't need the database transaction, so clean it up
		tx.Rollback()
	}

	url, err := b.client.GetBlobSASURI(b.container, info.ExternalID, time.Now().Add(10*time.Minute), "r")
	return newRedirectFileStream(url), err
}
Exemple #3
0
func (b *s3Backend) Open(tx *postgres.DBTx, info FileInfo, txControl bool) (FileStream, error) {
	if txControl {
		// We don't need the database transaction, so clean it up
		tx.Rollback()
	}

	req, _ := b.client.GetObjectRequest(&s3.GetObjectInput{
		Bucket: &b.bucket,
		Key:    &info.ExternalID,
	})
	url, err := req.Presign(10 * time.Minute)
	if err != nil {
		return nil, err
	}

	return newRedirectFileStream(url), nil
}