1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
633 B
Go

package store
// Provider implements the uploader Provider interface, allowing the
// Store to be used as a DataProvider for an uploader.
type Provider struct {
str *Store
vacuum bool
}
// NewProvider returns a new instance of Provider.
func NewProvider(s *Store, v bool) *Provider {
return &Provider{
str: s,
vacuum: v,
}
}
// Provider writes the SQLite database to the given path.
func (p *Provider) Provide(path string) error {
if err := p.str.db.Backup(path); err != nil {
return err
}
if p.vacuum {
if err := p.str.db.Vacuum(); err != nil {
return err
}
}
stats.Add(numProvides, 1)
return nil
}