mirror

package
v1.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package mirror implements the export file mirroring job.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Database              database.Config
	ObservabilityExporter observability.Config
	SecretManager         secrets.Config
	Storage               storage.Config

	Port string `env:"PORT, default=8080"`

	// Max file sizes for download. 1mb for index files, 20mb for zip files.
	MaxIndexBytes int64 `env:"MAX_INDEX_BYTES, default=1048576"`
	MaxZipBytes   int64 `env:"MAX_ZIP_BYTES, default=20971520"`

	// IndexFileDownloadTimeout is the amount of time to allow to download the
	// entire index file.
	IndexFileDownloadTimeout time.Duration `env:"INDEX_FILE_DOWNLOAD_TIMEOUT, default=30s"`

	// ExportFileDownloadTimeout, ExportFileDeleteTimeout, and
	// ExportFileUploadTimeout are the maximum amount of time to wait when
	// downloading, deleting, and uploading an export file, respectively.
	ExportFileDownloadTimeout time.Duration `env:"EXPORT_FILE_DOWNLOAD_TIMEOUT, default=1m"`
	ExportFileDeleteTimeout   time.Duration `env:"EXPORT_FILE_DELETE_TIMEOUT, default=10s"`
	ExportFileUploadTimeout   time.Duration `env:"EXPORT_FILE_UPLOAD_TIMEOUT, default=1m"`

	MaxRuntime         time.Duration `env:"MAX_RUNTIME, default=14m"`
	MirrorLockDuration time.Duration `env:"MIRROR_LOCK_DURATION, default=15m"`
}

func (*Config) BlobstoreConfig

func (c *Config) BlobstoreConfig() *storage.Config

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 FileStatus

type FileStatus struct {
	Order         int
	MirrorFile    *model.MirrorFile
	DownloadPath  string
	Filename      string
	LocalFilename string
	Failed        bool
	Saved         bool
}

type Response added in v0.22.0

type Response struct {
	Mirrors []*Status `json:"mirrors"`
}

type Server

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

Server hosts end points to manage key rotation.

func NewServer

func NewServer(config *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) Routes

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

Routes defines and returns the routes for this server.

type Status added in v0.22.0

type Status struct {
	ID        int64    `json:"id"`
	Processed bool     `json:"processed"`
	Errors    []string `json:"errors,omitempty"`
}

Directories

Path Synopsis
Package database is a database interface for mirror settings.
Package database is a database interface for mirror settings.
Package model is a model abstraction of mirror data structures.
Package model is a model abstraction of mirror data structures.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL