示例#1
0
文件: gcs.go 项目: ably-forks/flynn
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
}
示例#2
0
文件: azure.go 项目: imjorge/flynn
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
}
示例#3
0
文件: s3.go 项目: ably-forks/flynn
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
}