Documentation ¶
Overview ¶
Package database is a database interface to export.
Index ¶
- type ExportDB
- func (db *ExportDB) AddExportBatches(ctx context.Context, batches []*model.ExportBatch) error
- func (db *ExportDB) AddExportConfig(ctx context.Context, ec *model.ExportConfig) error
- func (db *ExportDB) AddSignatureInfo(ctx context.Context, si *model.SignatureInfo) error
- func (db *ExportDB) DeleteFilesBefore(ctx context.Context, before time.Time, blobstore storage.Blobstore) (int, error)
- func (db *ExportDB) FinalizeBatch(ctx context.Context, eb *model.ExportBatch, files []string, batchSize int) error
- func (db *ExportDB) GetAllExportConfigs(ctx context.Context) ([]*model.ExportConfig, error)
- func (db *ExportDB) GetExportConfig(ctx context.Context, id int64) (*model.ExportConfig, error)
- func (db *ExportDB) GetSignatureInfo(ctx context.Context, id int64) (*model.SignatureInfo, error)
- func (db *ExportDB) IterateExportConfigs(ctx context.Context, t time.Time, f func(*model.ExportConfig) error) (err error)
- func (db *ExportDB) LatestExportBatchEnd(ctx context.Context, ec *model.ExportConfig) (time.Time, error)
- func (db *ExportDB) LeaseBatch(ctx context.Context, ttl time.Duration, batchMaxCloseTime time.Time) (*model.ExportBatch, error)
- func (db *ExportDB) ListAllSignatureInfos(ctx context.Context) ([]*model.SignatureInfo, error)
- func (db *ExportDB) ListLatestExportBatchEnds(ctx context.Context) (map[int64]*time.Time, error)
- func (db *ExportDB) LookupExportBatch(ctx context.Context, batchID int64) (*model.ExportBatch, error)
- func (db *ExportDB) LookupExportFile(ctx context.Context, filename string) (*model.ExportFile, error)
- func (db *ExportDB) LookupExportFiles(ctx context.Context, configID int64, ttl time.Duration) ([]string, error)
- func (db *ExportDB) LookupSignatureInfos(ctx context.Context, ids []int64, validUntil time.Time) ([]*model.SignatureInfo, error)
- func (db *ExportDB) MarkExpiredFiles(ctx context.Context, configID int64, ttl time.Duration) (int, error)
- func (db *ExportDB) UpdateExportConfig(ctx context.Context, ec *model.ExportConfig) error
- func (db *ExportDB) UpdateSignatureInfo(ctx context.Context, si *model.SignatureInfo) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExportDB ¶
type ExportDB struct {
// contains filtered or unexported fields
}
func (*ExportDB) AddExportBatches ¶
AddExportBatches inserts new export batches.
func (*ExportDB) AddExportConfig ¶
AddExportConfig creates a new ExportConfig record from which batch jobs are created.
func (*ExportDB) AddSignatureInfo ¶
func (*ExportDB) DeleteFilesBefore ¶
func (db *ExportDB) DeleteFilesBefore(ctx context.Context, before time.Time, blobstore storage.Blobstore) (int, error)
DeleteFilesBefore deletes the export batch files for batches ending before the time passed in.
func (*ExportDB) FinalizeBatch ¶
func (db *ExportDB) FinalizeBatch(ctx context.Context, eb *model.ExportBatch, files []string, batchSize int) error
FinalizeBatch writes the ExportFile records and marks the ExportBatch as complete.
func (*ExportDB) GetAllExportConfigs ¶
func (*ExportDB) GetExportConfig ¶
func (*ExportDB) GetSignatureInfo ¶
GetSignatureInfo looks up a single signature info by ID.
func (*ExportDB) IterateExportConfigs ¶
func (db *ExportDB) IterateExportConfigs(ctx context.Context, t time.Time, f func(*model.ExportConfig) error) (err error)
IterateExportConfigs applies f to each ExportConfig whose FromTimestamp is before the given time. If f returns a non-nil error, the iteration stops, and the returned error will match f's error with errors.Is.
func (*ExportDB) LatestExportBatchEnd ¶
func (db *ExportDB) LatestExportBatchEnd(ctx context.Context, ec *model.ExportConfig) (time.Time, error)
LatestExportBatchEnd returns the end time of the most recent ExportBatch for a given ExportConfig. It returns the zero time if no previous ExportBatch exists.
func (*ExportDB) LeaseBatch ¶
func (db *ExportDB) LeaseBatch(ctx context.Context, ttl time.Duration, batchMaxCloseTime time.Time) (*model.ExportBatch, error)
LeaseBatch returns a leased ExportBatch for the worker to process. If no work to do, nil will be returned.
func (*ExportDB) ListAllSignatureInfos ¶ added in v0.14.0
func (*ExportDB) ListLatestExportBatchEnds ¶
ListLatestExportBatchEnds returns a map of export config IDs to their latest batch end times.
func (*ExportDB) LookupExportBatch ¶
func (db *ExportDB) LookupExportBatch(ctx context.Context, batchID int64) (*model.ExportBatch, error)
LookupExportBatch returns an ExportBatch for the given batchID.
func (*ExportDB) LookupExportFile ¶
func (*ExportDB) LookupExportFiles ¶
func (db *ExportDB) LookupExportFiles(ctx context.Context, configID int64, ttl time.Duration) ([]string, error)
LookupExportFiles returns a list of completed and unexpired export files for a specific config.
func (*ExportDB) LookupSignatureInfos ¶
func (*ExportDB) MarkExpiredFiles ¶ added in v0.18.0
func (db *ExportDB) MarkExpiredFiles(ctx context.Context, configID int64, ttl time.Duration) (int, error)
MarkExpiredFiles marks files for deletion.
func (*ExportDB) UpdateExportConfig ¶
UpdateExportConfig updates an existing ExportConfig record from which batch jobs are created.