You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: backup.go
    path of file: ./repos/ponzu/system/db
    
    the code of the file until where you have to start completion: package db

import (
	"context"
	"fmt"
	"net/http"
	"time"

	"github.com/boltdb/bolt"
)

// Backup writes a snapshot of the system.db database to an HTTP response. The
// output is discarded if we get a cancellation signal.
func Backup(ctx context.C
    
func Backup(ctx context.Context, res http.ResponseWriter) error {
	errChan := make(chan error, 1)

	go func() {
		errChan <- store.View(func(tx *bolt.Tx) error {
			ts := time.Now().Unix()
			disposition := `attachment; filename="system-%d.db.bak"`

			res.Header().Set("Content-Type", "application/octet-stream")
			res.Header().Set("Content-Disposition", fmt.Sprintf(disposition, ts))
			res.Header().Set("Content-Length", fmt.Sprintf("%d", int(tx.Size())))

			_, err := tx.WriteTo(res)
			return err
		})
	}()

	select {
	case <-ctx.Done():
		return ctx.Err()
	case err := <-errChan:
		return err
	}
}