exposure-notifications-server: github.com/google/exposure-notifications-server/internal/export/database Index | Files

package database

import "github.com/google/exposure-notifications-server/internal/export/database"

Package database is a database interface to export.

Index

Package Files

export.go

type ExportDB Uses

type ExportDB struct {
    // contains filtered or unexported fields
}

func New Uses

func New(db *database.DB) *ExportDB

func (*ExportDB) AddExportBatches Uses

func (db *ExportDB) AddExportBatches(ctx context.Context, batches []*model.ExportBatch) error

AddExportBatches inserts new export batches.

func (*ExportDB) AddExportConfig Uses

func (db *ExportDB) AddExportConfig(ctx context.Context, ec *model.ExportConfig) error

AddExportConfig creates a new ExportConfig record from which batch jobs are created.

func (*ExportDB) AddSignatureInfo Uses

func (db *ExportDB) AddSignatureInfo(ctx context.Context, si *model.SignatureInfo) error

func (*ExportDB) DeleteFilesBefore Uses

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 Uses

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 Uses

func (db *ExportDB) GetAllExportConfigs(ctx context.Context) ([]*model.ExportConfig, error)

func (*ExportDB) GetExportConfig Uses

func (db *ExportDB) GetExportConfig(ctx context.Context, id int64) (*model.ExportConfig, error)

func (*ExportDB) GetSignatureInfo Uses

func (db *ExportDB) GetSignatureInfo(ctx context.Context, id int64) (*model.SignatureInfo, error)

GetSignatureInfo looks up a single signature info by ID.

func (*ExportDB) IterateExportConfigs Uses

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 Uses

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 Uses

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) ListAllSigntureInfos Uses

func (db *ExportDB) ListAllSigntureInfos(ctx context.Context) ([]*model.SignatureInfo, error)

func (*ExportDB) ListLatestExportBatchEnds Uses

func (db *ExportDB) ListLatestExportBatchEnds(ctx context.Context) (map[int64]*time.Time, error)

ListLatestExportBatchEnds returns a map of export config IDs to their latest batch end times.

func (*ExportDB) LookupExportBatch Uses

func (db *ExportDB) LookupExportBatch(ctx context.Context, batchID int64) (*model.ExportBatch, error)

LookupExportBatch returns an ExportBatch for the given batchID.

func (*ExportDB) LookupExportFile Uses

func (db *ExportDB) LookupExportFile(ctx context.Context, filename string) (*model.ExportFile, error)

func (*ExportDB) LookupExportFiles Uses

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 Uses

func (db *ExportDB) LookupSignatureInfos(ctx context.Context, ids []int64, validUntil time.Time) ([]*model.SignatureInfo, error)

func (*ExportDB) UpdateExportConfig Uses

func (db *ExportDB) UpdateExportConfig(ctx context.Context, ec *model.ExportConfig) error

UpdateExportConfig updates an existing ExportConfig record from which batch jobs are created.

func (*ExportDB) UpdateSignatureInfo Uses

func (db *ExportDB) UpdateSignatureInfo(ctx context.Context, si *model.SignatureInfo) error

Package database imports 11 packages (graph) and is imported by 6 packages. Updated 2020-09-27. Refresh now. Tools for package owners.