Documentation

Overview

    Package exportimport imports export files into the local database

    Package exportimport implements the handlers for the export-importer functionality.

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var ErrArchiveNotFound = errors.New("archive file not found")

    Functions

    This section is empty.

    Types

    type Config

    type Config struct {
    	Database              database.Config
    	ObservabilityExporter observability.Config
    	SecretManager         secrets.Config
    
    	Port string `env:"PORT, default=8080"`
    
    	IndexFileDownloadTimeout  time.Duration `env:"INDEX_FILE_DOWNLOAD_TIMEOUT, default=30s"`
    	ExportFileDownloadTimeout time.Duration `env:"EXPORT_FILE_DOWNLOAD_TIMEOUT, default=2m"`
    
    	// For importing files that may have missed setting v1.5+ fields.
    	BackfillReportType          string `env:"BACKFILL_REPORT_TYPE, default=confirmed"`
    	BackfillDaysSinceOnset      bool   `env:"BACKFILL_DAYS_SINCE_ONSET, default=true"`
    	BackfillDaysSinceOnsetValue int    `env:"BACKFILL_DAYS_SINCE_ONSET_VALUE, default=10"`
    
    	MaxInsertBatchSize           int           `env:"MAX_INSERT_BATCH_SIZE, default=100"`
    	MaxIntervalAge               time.Duration `env:"MAX_INTERVAL_AGE_ON_PUBLISH, default=360h"`
    	MaxMagnitudeSymptomOnsetDays uint          `env:"MAX_SYMPTOM_ONSET_DAYS, default=14"`
    	CreatedAtTruncateWindow      time.Duration `env:"TRUNCATE_WINDOW, default=1h"`
    	// Each import config is locked while file are being imported. This is to prevent starvation in
    	// the event that there are multiple exportimport configurations. If a worker fails
    	// during processing, this defines the lock timeout.
    	ImportLockTime time.Duration `env:"IMPORT_LOCK_TIME, default=13m"`
    	// Maximum amount of time that an import worker should be allowed to run. This should be set
    	// lower that infrastructure level request timeouts and lower than the lock time.
    	MaxRuntime time.Duration `env:"MAX_RUNTIME, default=12m"`
    	// Each exposure is inserted with the app_package_name / healthAuthorityID that it was published with
    	// Use this string to signal that a key came from the export-importer job.
    	ImportAPKName string `env:"IMPORT_APP_PACKAGE_NAME, default=exportimport"`
    	// ImportRetryRate is the rate at which files that encounter an error while
    	// importing are retried.
    	ImportRetryRate time.Duration `env:"IMPORT_RETRY_RATE, default=6h"`
    }

    func (*Config) DatabaseConfig

    func (c *Config) DatabaseConfig() *database.Config

    func (*Config) ObservabilityExporterConfig

    func (c *Config) ObservabilityExporterConfig() *observability.Config

    func (*Config) SecretManagerConfig

    func (c *Config) SecretManagerConfig() *secrets.Config

    type ImportRequest

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

    type ImportResponse

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

    type Server

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

      Server hosts end points to manage key rotation

      func NewServer

      func NewServer(cfg *Config, env *serverenv.ServerEnv) (*Server, error)

        NewServer creates a Server that manages deletion of old export files that are no longer needed by clients for download.

        func (*Server) ImportExportFile

        func (s *Server) ImportExportFile(ctx context.Context, ir *ImportRequest) (*ImportResponse, error)

        func (*Server) Routes

        func (s *Server) Routes(ctx context.Context) *mux.Router

          Routes defines and returns the routes for this server.

          type SignatureAndKey

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

          Directories

          Path Synopsis
          Package database is a database interface for export importing.
          Package database is a database interface for export importing.
          Package model is a model abstraction of export import configuration and status.
          Package model is a model abstraction of export import configuration and status.