Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyFileIncrement(fileName string, increment io.Reader) error
- func CheckPgVersionAndPgControl(archiveDirectory string)
- func CleanupPrefetchDirectories(walFileName string, location string, cleaner Cleaner)
- func CompressAndEncrypt(source io.Reader, compressor compression.Compressor, crypter crypto.Crypter) io.Reader
- func Configure()
- func ConfigureCrypter() crypto.Crypter
- func ConfigureFolder() (storage.Folder, error)
- func ConfigureLimiters()
- func ConfigureLogging() error
- func Connect() (*pgx.Conn, error)
- func DecompressWALFile(dst io.Writer, archiveReader io.ReadCloser, ...) error
- func DecryptAndDecompressTar(writer io.Writer, readerMaker ReaderMaker, crypter crypto.Crypter) error
- func DeleteBeforeArgsValidator(cmd *cobra.Command, args []string) error
- func DeleteBeforeTarget(folder storage.Folder, target storage.Object, confirmed bool, ...) error
- func DeleteEverything(folder storage.Folder, confirmed bool, args []string)
- func DeleteEverythingArgsValidator(cmd *cobra.Command, args []string) error
- func DeleteRetainArgsValidator(cmd *cobra.Command, args []string) error
- func DownloadAndDecompressStream(backup *Backup, writeCloser io.WriteCloser) error
- func DownloadAndDecompressWALFile(folder storage.Folder, walFileName string) (io.ReadCloser, error)
- func DownloadLogFiles(logFiles []storage.Object, logFolder storage.Folder, handlers LogFetchHandlers) ([]storage.Object, error)
- func DownloadWALFileTo(folder storage.Folder, walFileName string, dstPath string) error
- func ExtractAll(tarInterpreter TarInterpreter, files []ReaderMaker) error
- func ExtractBlockLocations(records []walparser.XLogRecord) []walparser.BlockLocation
- func FetchLogs(folder storage.Folder, startTS time.Time, endTS *time.Time, ...) (fetched []storage.Object, err error)
- func FetchStreamSentinel(backup *Backup, sentinelDto interface{}) error
- func FileIsPiped(stream *os.File) bool
- func FindTarget(folder storage.Folder, compare func(object1, object2 storage.Object) bool, ...) (storage.Object, error)
- func FindTargetBeforeName(folder storage.Folder, name string, modifier int, ...) (storage.Object, error)
- func FindTargetBeforeTime(folder storage.Folder, timeLine time.Time, modifier int, ...) (storage.Object, error)
- func FindTargetRetain(folder storage.Folder, retentionCount, modifier int, ...) (storage.Object, error)
- func GetBaseFilesToUnwrap(backupFileStates BackupFileList, currentFilesToUnwrap map[string]bool) (map[string]bool, error)
- func GetBeforeChoiceFunc(name string, modifier int, isFullBackup func(object storage.Object) bool) func(object storage.Object) bool
- func GetDataFolderPath() string
- func GetDeltaFilenameFor(walFilename string) (string, error)
- func GetDeltaRange(firstUsedLsn, firstNotUsedLsn uint64) (DeltaNo, DeltaNo)
- func GetLastDecompressor() (compression.Decompressor, error)
- func GetLatestBackupName(folder storage.Folder) (string, error)
- func GetLogsCoveringInterval(folder storage.Folder, start time.Time, end *time.Time) ([]storage.Object, error)
- func GetLogsDstSettings(operationLogsDstEnvVariable string) (dstFolder string, err error)
- func GetMaxConcurrency(concurrencyType string) (int, error)
- func GetMaxDownloadConcurrency() (int, error)
- func GetMaxUploadConcurrency() (int, error)
- func GetMaxUploadDiskConcurrency() (int, error)
- func GetMaxUploadQueue() (int, error)
- func GetNameStreamCreateCmd() []string
- func GetNextWalFilename(name string) (string, error)
- func GetPgFetcher(dbDataDirectory, fileMask, restoreSpecPath string) func(folder storage.Folder, backup Backup)
- func GetPositionInDelta(walFilename string) int
- func GetPrefetchLocations(location string, walFileName string) (prefetchLocation string, runningLocation string, runningFile string, ...)
- func GetRelFileIdFrom(filePath string) (int, error)
- func GetRelFileNodeFrom(filePath string) (*walparser.RelFileNode, error)
- func GetRetainChoiceFunc(retentionCount, modifier int, isFullBackup func(object storage.Object) bool) func(object storage.Object) bool
- func GetSentinelUserData() interface{}
- func GetSetting(key string) (value string, ok bool)
- func GetStreamFetcher(writeCloser io.WriteCloser) func(folder storage.Folder, backup Backup)
- func GetWalSegmentRange(firstNotUsedDeltaNo DeltaNo, firstNotUsedLsn uint64) (WalSegmentNo, WalSegmentNo)
- func GetWaleCompatibleSetting(key string) (value string, exists bool)
- func HandleBackupFetch(folder storage.Folder, backupName string, ...)
- func HandleBackupList(folder storage.Folder)
- func HandleBackupListWithFlags(folder storage.Folder, pretty bool, json bool, detail bool)
- func HandleBackupMark(uploader *Uploader, backupName string, toPermanent bool)
- func HandleBackupPush(uploader *Uploader, archiveDirectory string, isPermanent bool, ...)
- func HandleDeleteBefore(folder storage.Folder, args []string, confirmed bool, ...)
- func HandleDeleteRetain(folder storage.Folder, args []string, confirmed bool, ...)
- func HandleWALFetch(folder storage.Folder, walFileName string, location string, ...)
- func HandleWALPrefetch(uploader *Uploader, walFileName string, location string)
- func HandleWALPush(uploader *Uploader, walFilePath string)
- func InitConfig()
- func IsAllowedSetting(setting string, AllowedSettings map[string]bool) (exists bool)
- func IsDirectoryEmpty(directoryPath string) (bool, error)
- func IsPgControlRequired(backup *Backup, sentinelDto BackupSentinelDto) bool
- func LoadExtensions(path string) error
- func LogFileShouldBeFetched(backupStartUploadTime time.Time, endTS *time.Time, object storage.Object) bool
- func MarkBackup(uploader *Uploader, folder storage.Folder, backupName string, toPermanent bool)
- func NewDiskLimitReader(r io.Reader) io.Reader
- func NewNetworkLimitReader(r io.Reader) io.Reader
- func PackFileTo(tarBall TarBall, fileInfoHeader *tar.Header, fileContent io.Reader) (fileSize int64, err error)
- func ParseTS(endTSEnvVar string) (endTS *time.Time, err error)
- func ParseWALFilename(name string) (timelineID uint32, logSegNo uint64, err error)
- func ReadIncrementFileHeader(reader io.Reader) error
- func ReadIncrementalFile(filePath string, fileSize int64, lsn uint64, deltaBitmap *roaring.Bitmap) (fileReader io.ReadCloser, size int64, err error)
- func ReadLocationsFrom(reader io.Reader) ([]walparser.BlockLocation, error)
- func ReadRestoreSpec(path string, spec *TablespaceSpec) (err error)
- func ReaderMakersToFilePaths(readerMakers []ReaderMaker) []string
- func RegisterExtensionCommands(rootCmd *cobra.Command)
- func SelectRelFileBlocks(bitmap *roaring.Bitmap, relFileId int) *roaring.Bitmap
- func SetLastDecompressor(decompressor compression.Decompressor) error
- func ShouldPrefault(name string) (lsn uint64, shouldPrefault bool, timelineId uint32, err error)
- func StartCommand(command []string) (waitFunc func(), stdout io.ReadCloser)
- func ToPartFilename(deltaFilename string) string
- func TryDownloadWALFile(folder storage.Folder, walPath string) (walFileReader io.ReadCloser, exists bool, err error)
- func UploadMetadata(uploader *Uploader, sentinelDto *BackupSentinelDto, backupName string, ...) error
- func UploadSentinel(uploader *Uploader, sentinelDto interface{}, backupName string) error
- func UploadWALFile(uploader *Uploader, walFilePath string, preventWalOverwrite bool) error
- func WriteAsJson(data interface{}, output io.Writer, pretty bool) error
- func WriteBackupList(backups []BackupTime, output io.Writer)
- func WriteBackupListDetails(backupDetails []BackupDetail, output io.Writer)
- func WriteLocationsTo(writer io.Writer, locations []walparser.BlockLocation) error
- func WritePrettyBackupList(backups []BackupTime, output io.Writer)
- func WritePrettyBackupListDetails(backupDetails []BackupDetail, output io.Writer)
- type ArchiveNonExistenceError
- type ArchiveStatusManager
- type Backup
- func (backup *Backup) CheckExistence() (bool, error)
- func (backup *Backup) FetchMeta() (ExtendedMetadataDto, error)
- func (backup *Backup) FetchSentinelData() ([]byte, error)
- func (backup *Backup) GetFilesToUnwrap(fileMask string) (map[string]bool, error)
- func (backup *Backup) GetMetadataPath() string
- func (backup *Backup) GetSentinel() (BackupSentinelDto, error)
- func (backup *Backup) GetStopSentinelPath() string
- func (backup *Backup) GetTarNames() ([]string, error)
- type BackupAlreadyThisTypePermanentError
- type BackupDetail
- type BackupFileDescription
- type BackupFileList
- type BackupFromFuture
- type BackupFromOtherBD
- type BackupHasPermanentBackupInFutureError
- type BackupNonExistenceError
- type BackupSentinelDto
- type BackupTime
- type BgUploader
- type BlockLocationReader
- type BlockLocationWriter
- type Bundle
- func (bundle *Bundle) CheckSizeAndEnqueueBack(tarBall TarBall) error
- func (bundle *Bundle) Deque() TarBall
- func (bundle *Bundle) DownloadDeltaMap(folder storage.Folder, backupStartLSN uint64) error
- func (bundle *Bundle) EnqueueBack(tarBall TarBall)
- func (bundle *Bundle) FinishQueue() error
- func (bundle *Bundle) GetFileRelPath(fileAbsPath string) string
- func (bundle *Bundle) GetFiles() *sync.Map
- func (bundle *Bundle) GetIncrementBaseFiles() BackupFileList
- func (bundle *Bundle) GetIncrementBaseLsn() *uint64
- func (bundle *Bundle) HandleWalkedFSObject(path string, info os.FileInfo, err error) error
- func (bundle *Bundle) NewTarBall(dedicatedUploader bool)
- func (bundle *Bundle) PrefaultWalkedFSObject(path string, info os.FileInfo, err error) error
- func (bundle *Bundle) StartBackup(conn *pgx.Conn, backup string) (backupName string, lsn uint64, version int, dataDir string, ...)
- func (bundle *Bundle) StartQueue() error
- func (bundle *Bundle) UploadLabelFiles(conn *pgx.Conn) (uint64, error)
- func (bundle *Bundle) UploadPgControl(compressorFileExtension string) error
- type BytesPerWalSegmentError
- type CachedDecompressor
- type CantDiscardWalDataError
- type CantOverwriteWalFileError
- type CascadeWriteCloser
- type Cleaner
- type CompressAndEncryptError
- type DataFolder
- type DataFolderASM
- type DeltaFile
- type DeltaFileChanWriter
- type DeltaFileManager
- func (manager *DeltaFileManager) CancelRecording(walFilename string)
- func (manager *DeltaFileManager) CombinePartFile(deltaFilename string, partFile *WalPartFile) error
- func (manager *DeltaFileManager) FlushDeltaFiles(uploader *Uploader, completedPartFiles map[string]bool)
- func (manager *DeltaFileManager) FlushFiles(uploader *Uploader)
- func (manager *DeltaFileManager) FlushPartFiles() (completedPartFiles map[string]bool)
- func (manager *DeltaFileManager) GetBlockLocationConsumer(deltaFilename string) (chan walparser.BlockLocation, error)
- func (manager *DeltaFileManager) GetPartFile(deltaFilename string) (*WalPartFile, error)
- func (manager *DeltaFileManager) LoadDeltaFileWriter(deltaFilename string) (deltaFileWriter *DeltaFileChanWriter, err error)
- func (manager *DeltaFileManager) LoadPartFile(partFilename string) (*WalPartFile, error)
- type DeltaFileWriterNotFoundError
- type DeltaNo
- func (deltaNo DeltaNo) Add(n uint64) DeltaNo
- func (deltaNo DeltaNo) FirstLsn() uint64
- func (deltaNo DeltaNo) FirstWalSegmentNo() WalSegmentNo
- func (deltaNo DeltaNo) GetFilename(timeline uint32) string
- func (deltaNo DeltaNo) Next() DeltaNo
- func (deltaNo DeltaNo) Previous() DeltaNo
- func (deltaNo DeltaNo) Sub(n uint64) DeltaNo
- type DiskDataFolder
- func (folder *DiskDataFolder) CleanFolder() error
- func (folder *DiskDataFolder) CreateFile(filename string) error
- func (folder *DiskDataFolder) DeleteFile(filename string) error
- func (folder *DiskDataFolder) FileExists(filename string) bool
- func (folder *DiskDataFolder) OpenReadonlyFile(filename string) (io.ReadCloser, error)
- func (folder *DiskDataFolder) OpenWriteOnlyFile(filename string) (io.WriteCloser, error)
- type EmptyWriteIgnorer
- type ExponentialRetrier
- type ExtendedMetadataDto
- type Extension
- type FileSystemCleaner
- type FileTarInterpreter
- type IncorrectLogSegNoError
- type IncrementalPageReader
- func (pageReader *IncrementalPageReader) AdvanceFileReader() error
- func (pageReader *IncrementalPageReader) Close() error
- func (pageReader *IncrementalPageReader) DeltaBitmapInitialize(deltaBitmap *roaring.Bitmap)
- func (pageReader *IncrementalPageReader) DrainMoreData() (succeed bool, err error)
- func (pageReader *IncrementalPageReader) FullScanInitialize() error
- func (pageReader *IncrementalPageReader) Read(p []byte) (n int, err error)
- func (pageReader *IncrementalPageReader) SelectNewValidPage(pageBytes []byte, blockNo uint32) (valid bool)
- func (pageReader *IncrementalPageReader) WriteDiffMapToHeader(headerWriter io.Writer)
- type InvalidBlockError
- type InvalidConcurrencyValueError
- type InvalidIncrementFileHeaderError
- type InvalidWalFileMagicError
- type LazyCache
- func (lazyCache *LazyCache) Load(key interface{}) (value interface{}, exists bool, err error)
- func (lazyCache *LazyCache) LoadExisting(key interface{}) (value interface{}, exists bool)
- func (lazyCache *LazyCache) Range(reduce func(key, value interface{}) bool)
- func (lazyCache *LazyCache) Store(key, value interface{})
- type LogFetchHandlers
- type LogFetchSettings
- type NOPTarBall
- type NOPTarBallMaker
- type NamedReader
- type NamedReaderImpl
- type NilWalParserError
- type NoBackupsFoundError
- type NoBitmapFoundError
- type NoFilesToExtractError
- type NoPostgresVersionError
- type NoSuchFileError
- type NonEmptyDbDataDirectoryError
- type NopASM
- type NotWalFilenameError
- type PagedFileDeltaMap
- func (deltaMap *PagedFileDeltaMap) AddLocationToDelta(location walparser.BlockLocation)
- func (deltaMap *PagedFileDeltaMap) AddLocationsToDelta(locations []walparser.BlockLocation)
- func (deltaMap *PagedFileDeltaMap) GetDeltaBitmapFor(filePath string) (*roaring.Bitmap, error)
- func (deltaMap *PagedFileDeltaMap) GetLocationsFromDeltas(folder storage.Folder, timeline uint32, first, last DeltaNo) error
- func (deltaMap *PagedFileDeltaMap) GetLocationsFromWals(folder storage.Folder, timeline uint32, first, last WalSegmentNo, ...) error
- type PgControlNotFoundError
- type PgQueryRunner
- func (queryRunner *PgQueryRunner) BuildGetSystemIdentifier() string
- func (queryRunner *PgQueryRunner) BuildGetVersion() string
- func (queryRunner *PgQueryRunner) BuildStartBackup() (string, error)
- func (queryRunner *PgQueryRunner) BuildStopBackup() (string, error)
- func (queryRunner *PgQueryRunner) StartBackup(backup string) (backupName string, lsnString string, inRecovery bool, dataDir string, ...)
- func (queryRunner *PgQueryRunner) StopBackup() (label string, offsetMap string, lsnStr string, err error)
- type PostgresPageHeader
- type QueryRunner
- type ReaderMaker
- type Saver
- type Sentinel
- type SentinelMarshallingError
- type StorageAdapter
- type StorageReaderMaker
- type StorageTarBall
- func (tarBall *StorageTarBall) AddSize(i int64)
- func (tarBall *StorageTarBall) AwaitUploads()
- func (tarBall *StorageTarBall) CloseTar() error
- func (tarBall *StorageTarBall) SetUp(crypter crypto.Crypter, names ...string)
- func (tarBall *StorageTarBall) Size() int64
- func (tarBall *StorageTarBall) TarWriter() *tar.Writer
- type StorageTarBallMaker
- type TablespaceLocation
- type TablespaceSpec
- func (spec *TablespaceSpec) AddTablespace(symlinkName string, actualLocation string)
- func (spec *TablespaceSpec) BasePrefix() (string, bool)
- func (spec *TablespaceSpec) Empty() bool
- func (spec *TablespaceSpec) IsTablespaceSymlink(path string) (bool, error)
- func (spec *TablespaceSpec) Length() int
- func (spec *TablespaceSpec) Location(symlinkName string) (TablespaceLocation, bool)
- func (spec *TablespaceSpec) MakeTablespaceSymlinkPath(path string) (string, error)
- func (spec *TablespaceSpec) MarshalJSON() ([]byte, error)
- func (spec *TablespaceSpec) SetBasePrefix(basePrefix string)
- func (spec *TablespaceSpec) TablespaceLocations() []TablespaceLocation
- func (spec *TablespaceSpec) TablespaceNames() []string
- func (spec *TablespaceSpec) UnmarshalJSON(b []byte) error
- type TarBall
- type TarBallMaker
- type TarInterpreter
- type TarSizeError
- type UnconfiguredStorageError
- type UnexpectedTarDataError
- type UnknownCompressionMethodError
- type UnknownIncrementFileHeaderError
- type UnknownTableSpaceError
- type UnmarshallingError
- type UnsetRequiredSettingError
- type UnsupportedFileTypeError
- type UnsupportedPostgresVersionError
- type UploadObject
- type Uploader
- func (uploader *Uploader) Clone() *Uploader
- func (uploader *Uploader) PushStream(stream io.Reader) (string, error)
- func (uploader *Uploader) PushStreamToDestination(stream io.Reader, dstPath string) error
- func (uploader *Uploader) Upload(path string, content io.Reader) error
- func (uploader *Uploader) UploadFile(file NamedReader) error
- func (uploader *Uploader) UploadMultiple(objects []UploadObject) error
- func (uploader *Uploader) UploadWalFile(file NamedReader) error
- type WalDeltaRecorder
- type WalDeltaRecordingReader
- type WalPart
- type WalPartDataType
- type WalPartFile
- type WalPartRecorder
- type WalSegmentNo
- func (walSegmentNo WalSegmentNo) Add(n uint64) WalSegmentNo
- func (walSegmentNo WalSegmentNo) FirstLsn() uint64
- func (walSegmentNo WalSegmentNo) GetFilename(timeline uint32) string
- func (walSegmentNo WalSegmentNo) Next() WalSegmentNo
- func (walSegmentNo WalSegmentNo) Previous() WalSegmentNo
- func (walSegmentNo WalSegmentNo) Sub(n uint64) WalSegmentNo
- type WithSizeReader
- type WrongTypeError
Constants ¶
const ( TarPartitionFolderName = "/tar_partitions/" PgControlPath = "/global/pg_control" )
const ( PgControl = "pg_control" BackupLabelFilename = "backup_label" TablespaceMapFilename = "tablespace_map" TablespaceFolder = "pg_tblspc" )
const ( DownloadConcurrencySetting = "WALG_DOWNLOAD_CONCURRENCY" UploadConcurrencySetting = "WALG_UPLOAD_CONCURRENCY" UploadDiskConcurrencySetting = "WALG_UPLOAD_DISK_CONCURRENCY" UploadQueueSetting = "WALG_UPLOAD_QUEUE" SentinelUserDataSetting = "WALG_SENTINEL_USER_DATA" PreventWalOverwriteSetting = "WALG_PREVENT_WAL_OVERWRITE" DeltaMaxStepsSetting = "WALG_DELTA_MAX_STEPS" DeltaOriginSetting = "WALG_DELTA_ORIGIN" CompressionMethodSetting = "WALG_COMPRESSION_METHOD" DiskRateLimitSetting = "WALG_DISK_RATE_LIMIT" NetworkRateLimitSetting = "WALG_NETWORK_RATE_LIMIT" UseWalDeltaSetting = "WALG_USE_WAL_DELTA" LogLevelSetting = "WALG_LOG_LEVEL" TarSizeThresholdSetting = "WALG_TAR_SIZE_THRESHOLD" CseKmsIDSetting = "WALG_CSE_KMS_ID" CseKmsRegionSetting = "WALG_CSE_KMS_REGION" GpgKeyIDSetting = "GPG_KEY_ID" PgpKeySetting = "WALG_PGP_KEY" PgpKeyPathSetting = "WALG_PGP_KEY_PATH" PgpKeyPassphraseSetting = "WALG_PGP_KEY_PASSPHRASE" PgDataSetting = "PGDATA" UserSetting = "USER" // TODO : do something with it PgPortSetting = "PGPORT" PgUserSetting = "PGUSER" PgHostSetting = "PGHOST" PgPasswordSetting = "PGPASSWORD" PgDatabaseSetting = "PGDATABASE" PgSslModeSetting = "PGSSLMODE" TotalBgUploadedLimit = "TOTAL_BG_UPLOADED_LIMIT" NameStreamCreateCmd = "WALG_STREAM_CREATE_COMMAND" )
const ( DefaultDataBurstRateLimit = 8 * int64(DatabasePageSize) DefaultDataFolderPath = "/tmp" WaleFileHost = "file://localhost" )
const ( NoDeleteModifier = iota FullDeleteModifier FindFullDeleteModifier ForceDeleteModifier ConfirmFlag = "confirm" DeleteShortDescription = "Clears old backups and WALs" DeleteRetainExamples = `` /* 210-byte string literal not displayed */ DeleteBeforeExamples = `` /* 156-byte string literal not displayed */ DeleteEverythingExamples = `` /* 152-byte string literal not displayed */ DeleteEverythingUsageExample = "everything [FORCE]" DeleteRetainUsageExample = "retain [FULL|FIND_FULL] backup_count" DeleteBeforeUsageExample = "before [FIND_FULL] backup_name|timestamp" )
const ( RelFileSizeBound = 1 << 30 BlocksInRelFile = RelFileSizeBound / int(DatabasePageSize) DefaultSpcNode walparser.Oid = 1663 )
const ( DatabasePageSize = walparser.BlockSize SignatureMagicNumber byte = 0x55 DefaultTablespace = "base" GlobalTablespace = "global" NonDefaultTablespace = "pg_tblspc" )
const ( BasePrefix = "base_prefix" Tablespaces = "tablespaces" )
const ( WalFileInDelta uint64 = 16 DeltaFilenameSuffix = "_delta" PartFilenameSuffix = "_part" )
const LatestString = "LATEST"
const MinAllowedConcurrency = 1
const (
RecordPartFilename = "currentRecord.part"
)
const (
StreamPrefix = "stream_"
)
const ( // WalSegmentSize is the size of one WAL file WalSegmentSize = uint64(16 * 1024 * 1024) // xlog.c line 113ß )
Variables ¶
var ( CfgFile string AllowedSettings = map[string]bool{ DownloadConcurrencySetting: true, UploadConcurrencySetting: true, UploadDiskConcurrencySetting: true, UploadQueueSetting: true, SentinelUserDataSetting: true, PreventWalOverwriteSetting: true, DeltaMaxStepsSetting: true, DeltaOriginSetting: true, CompressionMethodSetting: true, DiskRateLimitSetting: true, NetworkRateLimitSetting: true, UseWalDeltaSetting: true, LogLevelSetting: true, TarSizeThresholdSetting: true, "WALG_" + GpgKeyIDSetting: true, "WALE_" + GpgKeyIDSetting: true, PgpKeySetting: true, PgpKeyPathSetting: true, PgpKeyPassphraseSetting: true, TotalBgUploadedLimit: true, NameStreamCreateCmd: true, PgPortSetting: true, PgUserSetting: true, PgHostSetting: true, PgPasswordSetting: true, PgDatabaseSetting: true, PgSslModeSetting: true, "WALG_SWIFT_PREFIX": true, "OS_AUTH_URL": true, "OS_USERNAME": true, "OS_PASSWORD": true, "OS_TENANT_NAME": true, "OS_REGION_NAME": true, "WALG_S3_PREFIX": true, "WALE_S3_PREFIX": true, "AWS_ACCESS_KEY_ID": true, "AWS_SECRET_ACCESS_KEY": true, "AWS_SESSION_TOKEN": true, "AWS_DEFAULT_REGION": true, "AWS_DEFAULT_OUTPUT": true, "AWS_PROFILE": true, "AWS_ROLE_SESSION_NAME": true, "AWS_CA_BUNDLE": true, "AWS_SHARED_CREDENTIALS_FILE": true, "AWS_CONFIG_FILE": true, "AWS_REGION": true, "AWS_ENDPOINT": true, "AWS_S3_FORCE_PATH_STYLE": true, "WALG_S3_CA_CERT_FILE": true, "WALG_S3_STORAGE_CLASS": true, "WALG_S3_SSE": true, "WALG_S3_SSE_KMS_ID": true, "WALG_CSE_KMS_ID": true, "WALG_CSE_KMS_REGION": true, "WALG_AZ_PREFIX": true, "AZURE_STORAGE_ACCOUNT": true, "AZURE_STORAGE_KEY": true, "WALG_AZURE_BUFFER_SIZE": true, "WALG_AZURE_MAX_BUFFERS": true, "WALG_GS_PREFIX": true, "GOOGLE_APPLICATION_CREDENTIALS": true, "WALG_FILE_PREFIX": true, } )
var BasePrefixMissingError = fmt.Errorf("Base prefix not set while working with tablespaces.\n")
var DeprecatedExternalGpgMessage = fmt.Sprintf( `You are using deprecated functionality that uses an external gpg library. It will be removed in next major version. Please set GPG key using environment variables %s or %s. `, PgpKeySetting, PgpKeyPathSetting)
var DiskLimiter *rate.Limiter
var ExcludedFilenames = make(map[string]utility.Empty)
ExcludedFilenames is a list of excluded members from the bundled backup.
var Extensions []Extension
var IncrementFileHeader = []byte{'w', 'i', '1', SignatureMagicNumber}
"wi" at the head stands for "wal-g increment" format version "1", signature magic number
var MaxExtractRetryWait = 5 * time.Minute
var MinExtractRetryWait = time.Minute
var NetworkLimiter *rate.Limiter
var StorageAdapters = []StorageAdapter{ {"S3_PREFIX", s3.SettingList, s3.ConfigureFolder, nil}, {"FILE_PREFIX", nil, fs.ConfigureFolder, preprocessFilePrefix}, {"GS_PREFIX", gcs.SettingList, gcs.ConfigureFolder, nil}, {"AZ_PREFIX", azure.SettingList, azure.ConfigureFolder, nil}, {"SWIFT_PREFIX", swift.SettingList, swift.ConfigureFolder, nil}, }
var StringModifiers = []string{"FULL", "FIND_FULL"}
var StringModifiersDeleteEverything = []string{"FORCE"}
var TerminalLocation = *walparser.NewBlockLocation(0, 0, 0, 0)
var UnwrapAll map[string]bool = nil
var UtilityFilePaths = map[string]bool{ PgControlPath: true, BackupLabelFilename: true, TablespaceMapFilename: true, }
Functions ¶
func ApplyFileIncrement ¶
ApplyFileIncrement changes pages according to supplied change map file
func CheckPgVersionAndPgControl ¶ added in v0.2.14
func CheckPgVersionAndPgControl(archiveDirectory string)
func CompressAndEncrypt ¶ added in v0.2.10
func CompressAndEncrypt(source io.Reader, compressor compression.Compressor, crypter crypto.Crypter) io.Reader
CompressAndEncrypt compresses input to a pipe reader. Output must be used or pipe will block.
func ConfigureCrypter ¶ added in v0.2.10
ConfigureCrypter uses environment variables to create and configure a crypter. In case no configuration in environment variables found, return `<nil>` value.
func ConfigureFolder ¶ added in v0.2.8
TODO : unit tests
func Connect ¶
Connect establishes a connection to postgres using a UNIX socket. Must export PGHOST and run with `sudo -E -u postgres`. If PGHOST is not set or if the connection fails, an error is returned and the connection is `<nil>`.
Example: PGHOST=/var/run/postgresql or PGHOST=10.0.0.1
func DecompressWALFile ¶ added in v0.2.7
func DecompressWALFile(dst io.Writer, archiveReader io.ReadCloser, decompressor compression.Decompressor) error
TODO : unit tests
func DecryptAndDecompressTar ¶
func DecryptAndDecompressTar(writer io.Writer, readerMaker ReaderMaker, crypter crypto.Crypter) error
TODO : unit tests Ensures that file extension is valid. Any subsequent behavior depends on file type.
func DeleteBeforeArgsValidator ¶ added in v0.2.10
func DeleteBeforeTarget ¶ added in v0.2.10
func DeleteEverything ¶ added in v0.2.13
func DeleteEverythingArgsValidator ¶ added in v0.2.13
func DeleteRetainArgsValidator ¶ added in v0.2.10
func DownloadAndDecompressStream ¶ added in v0.2.10
func DownloadAndDecompressStream(backup *Backup, writeCloser io.WriteCloser) error
DownloadAndDecompressStream downloads, decompresses and writes stream to stdout
func DownloadAndDecompressWALFile ¶ added in v0.2.10
TODO : unit tests
func DownloadLogFiles ¶ added in v0.2.12
func DownloadLogFiles(logFiles []storage.Object, logFolder storage.Folder, handlers LogFetchHandlers) ([]storage.Object, error)
DownloadLogFiles downloads files to specified folder
func DownloadWALFileTo ¶ added in v0.2.7
TODO : unit tests downloadWALFileTo downloads a file and writes it to local file
func ExtractAll ¶
func ExtractAll(tarInterpreter TarInterpreter, files []ReaderMaker) error
TODO : unit tests ExtractAll Handles all files passed in. Supports `.lzo`, `.lz4`, `.lzma`, and `.tar`. File type `.nop` is used for testing purposes. Each file is extracted in its own goroutine and ExtractAll will wait for all goroutines to finish. Returns the first error encountered.
func ExtractBlockLocations ¶
func ExtractBlockLocations(records []walparser.XLogRecord) []walparser.BlockLocation
func FetchStreamSentinel ¶ added in v0.2.12
TODO : unit tests
func FileIsPiped ¶ added in v0.2.10
FileIsPiped Check if file is piped
func FindTarget ¶ added in v0.2.10
func FindTargetBeforeName ¶ added in v0.2.8
func FindTargetBeforeTime ¶ added in v0.2.10
func FindTargetRetain ¶ added in v0.2.10
func GetBaseFilesToUnwrap ¶
func GetBeforeChoiceFunc ¶ added in v0.2.10
func GetDataFolderPath ¶ added in v0.2.10
func GetDataFolderPath() string
func GetDeltaFilenameFor ¶
func GetDeltaRange ¶ added in v0.2.12
func GetLastDecompressor ¶ added in v0.2.10
func GetLastDecompressor() (compression.Decompressor, error)
func GetLatestBackupName ¶ added in v0.2.7
TODO : unit tests
func GetLogsCoveringInterval ¶ added in v0.2.12
func GetLogsCoveringInterval(folder storage.Folder, start time.Time, end *time.Time) ([]storage.Object, error)
GetLogsCoveringInterval lists the operation logs that cover the interval
func GetLogsDstSettings ¶ added in v0.2.14
GetLogsDstSettings reads from the environment variables fetch settings
func GetMaxConcurrency ¶ added in v0.2.10
func GetMaxDownloadConcurrency ¶ added in v0.2.10
func GetMaxUploadConcurrency ¶ added in v0.2.10
func GetMaxUploadDiskConcurrency ¶ added in v0.2.10
func GetMaxUploadQueue ¶ added in v0.2.10
This setting is intentionally undocumented in README. Effectively, this configures how many prepared tar Files there may be in uploading state during backup-push.
func GetNameStreamCreateCmd ¶ added in v0.2.12
func GetNameStreamCreateCmd() []string
func GetNextWalFilename ¶
GetNextWalFilename computes name of next WAL segment
func GetPgFetcher ¶ added in v0.2.14
func GetPositionInDelta ¶
func GetPrefetchLocations ¶
func GetRelFileIdFrom ¶
func GetRelFileNodeFrom ¶
func GetRelFileNodeFrom(filePath string) (*walparser.RelFileNode, error)
func GetRetainChoiceFunc ¶ added in v0.2.10
func GetSentinelUserData ¶
func GetSentinelUserData() interface{}
func GetSetting ¶ added in v0.2.10
func GetStreamFetcher ¶ added in v0.2.14
func GetStreamFetcher(writeCloser io.WriteCloser) func(folder storage.Folder, backup Backup)
func GetWalSegmentRange ¶ added in v0.2.12
func GetWalSegmentRange(firstNotUsedDeltaNo DeltaNo, firstNotUsedLsn uint64) (WalSegmentNo, WalSegmentNo)
func GetWaleCompatibleSetting ¶ added in v0.2.10
func HandleBackupFetch ¶
func HandleBackupFetch(folder storage.Folder, backupName string, fetcher func(folder storage.Folder, backup Backup))
TODO : unit tests HandleBackupFetch is invoked to perform wal-g backup-fetch
func HandleBackupList ¶
TODO : unit tests HandleBackupList is invoked to perform wal-g backup-list
func HandleBackupListWithFlags ¶ added in v0.2.10
TODO : unit tests
func HandleBackupMark ¶ added in v0.2.12
func HandleBackupPush ¶
func HandleBackupPush(uploader *Uploader, archiveDirectory string, isPermanent bool, isFullBackup bool)
TODO : unit tests HandleBackupPush is invoked to perform a wal-g backup-push
func HandleDeleteBefore ¶ added in v0.2.10
func HandleDeleteRetain ¶ added in v0.2.8
func HandleWALFetch ¶
func HandleWALFetch(folder storage.Folder, walFileName string, location string, triggerPrefetch bool)
TODO : unit tests HandleWALFetch is invoked to performa wal-g wal-fetch
func HandleWALPrefetch ¶
TODO : unit tests HandleWALPrefetch is invoked by wal-fetch command to speed up database restoration
func HandleWALPush ¶
TODO : unit tests HandleWALPush is invoked to perform wal-g wal-push
func InitConfig ¶ added in v0.2.10
func InitConfig()
initConfig reads in config file and ENV variables if set.
func IsAllowedSetting ¶ added in v0.2.13
func IsPgControlRequired ¶ added in v0.2.4
func IsPgControlRequired(backup *Backup, sentinelDto BackupSentinelDto) bool
func LoadExtensions ¶ added in v0.2.7
func LogFileShouldBeFetched ¶ added in v0.2.12
func MarkBackup ¶ added in v0.2.12
MarkBackup marks a backup as permanent or impermanent
func NewDiskLimitReader ¶
NewDiskLimitReader returns a reader that is rate limited by disk limiter
func NewNetworkLimitReader ¶
NewNetworkLimitReader returns a reader that is rate limited by network limiter
func PackFileTo ¶
func ParseWALFilename ¶
ParseWALFilename extracts numeric parts from WAL file name
func ReadIncrementFileHeader ¶
func ReadIncrementalFile ¶
func ReadLocationsFrom ¶
func ReadLocationsFrom(reader io.Reader) ([]walparser.BlockLocation, error)
func ReadRestoreSpec ¶ added in v0.2.13
func ReadRestoreSpec(path string, spec *TablespaceSpec) (err error)
func ReaderMakersToFilePaths ¶
func ReaderMakersToFilePaths(readerMakers []ReaderMaker) []string
func RegisterExtensionCommands ¶ added in v0.2.8
func SelectRelFileBlocks ¶
func SetLastDecompressor ¶ added in v0.2.10
func SetLastDecompressor(decompressor compression.Decompressor) error
func ShouldPrefault ¶
func StartCommand ¶ added in v0.2.12
func StartCommand(command []string) (waitFunc func(), stdout io.ReadCloser)
func ToPartFilename ¶
func TryDownloadWALFile ¶
func UploadMetadata ¶ added in v0.2.10
func UploadMetadata(uploader *Uploader, sentinelDto *BackupSentinelDto, backupName string, meta ExtendedMetadataDto) error
TODO : unit tests
func UploadSentinel ¶ added in v0.2.7
TODO : unit tests
func UploadWALFile ¶ added in v0.2.7
TODO : unit tests uploadWALFile from FS to the cloud
func WriteAsJson ¶ added in v0.2.12
func WriteBackupList ¶ added in v0.2.10
func WriteBackupList(backups []BackupTime, output io.Writer)
TODO : unit tests
func WriteBackupListDetails ¶ added in v0.2.10
func WriteBackupListDetails(backupDetails []BackupDetail, output io.Writer)
TODO : unit tests
func WriteLocationsTo ¶
func WriteLocationsTo(writer io.Writer, locations []walparser.BlockLocation) error
func WritePrettyBackupList ¶ added in v0.2.10
func WritePrettyBackupList(backups []BackupTime, output io.Writer)
TODO : unit tests
func WritePrettyBackupListDetails ¶ added in v0.2.10
func WritePrettyBackupListDetails(backupDetails []BackupDetail, output io.Writer)
TODO : unit tests
Types ¶
type ArchiveNonExistenceError ¶
type ArchiveNonExistenceError struct {
// contains filtered or unexported fields
}
func NewArchiveNonExistenceError ¶
func NewArchiveNonExistenceError(archiveName string) ArchiveNonExistenceError
func (ArchiveNonExistenceError) Error ¶
func (err ArchiveNonExistenceError) Error() string
type ArchiveStatusManager ¶ added in v0.2.14
type ArchiveStatusManager interface {
// contains filtered or unexported methods
}
func NewNopASM ¶ added in v0.2.14
func NewNopASM() ArchiveStatusManager
type Backup ¶
type Backup struct { BaseBackupFolder storage.Folder Name string SentinelDto *BackupSentinelDto // used for storage query caching }
Backup contains information about a valid backup generated and uploaded by WAL-G.
func GetBackupByName ¶
func (*Backup) CheckExistence ¶
CheckExistence checks that the specified backup exists.
func (*Backup) FetchMeta ¶ added in v0.2.10
func (backup *Backup) FetchMeta() (ExtendedMetadataDto, error)
func (*Backup) FetchSentinelData ¶ added in v0.2.10
TODO : unit tests
func (*Backup) GetFilesToUnwrap ¶ added in v0.2.10
func (*Backup) GetMetadataPath ¶ added in v0.2.10
func (*Backup) GetSentinel ¶ added in v0.2.10
func (backup *Backup) GetSentinel() (BackupSentinelDto, error)
func (*Backup) GetStopSentinelPath ¶ added in v0.2.7
func (*Backup) GetTarNames ¶
type BackupAlreadyThisTypePermanentError ¶ added in v0.2.12
type BackupAlreadyThisTypePermanentError struct {
// contains filtered or unexported fields
}
func NewBackupAlreadyThisTypePermanentError ¶ added in v0.2.12
func NewBackupAlreadyThisTypePermanentError(backupName string, permanentType string) BackupAlreadyThisTypePermanentError
raise when user try make permanent/impermanent already permanent/impermanent backup,
type BackupDetail ¶ added in v0.2.10
type BackupDetail struct { BackupTime ExtendedMetadataDto }
BackupDetails is used to append ExtendedMetadataDto details to BackupTime struct
type BackupFileDescription ¶
type BackupFileDescription struct { IsIncremented bool // should never be both incremented and Skipped IsSkipped bool MTime time.Time }
func NewBackupFileDescription ¶
func NewBackupFileDescription(isIncremented, isSkipped bool, modTime time.Time) *BackupFileDescription
type BackupFileList ¶
type BackupFileList map[string]BackupFileDescription
type BackupFromFuture ¶ added in v0.2.13
type BackupFromFuture struct {
// contains filtered or unexported fields
}
func NewBackupFromFuture ¶ added in v0.2.13
func NewBackupFromFuture(backupName string) BackupFromFuture
func (BackupFromFuture) Error ¶ added in v0.2.13
func (err BackupFromFuture) Error() string
type BackupFromOtherBD ¶ added in v0.2.13
type BackupFromOtherBD struct {
// contains filtered or unexported fields
}
func NewBackupFromOtherBD ¶ added in v0.2.13
func NewBackupFromOtherBD() BackupFromOtherBD
func (BackupFromOtherBD) Error ¶ added in v0.2.13
func (err BackupFromOtherBD) Error() string
type BackupHasPermanentBackupInFutureError ¶ added in v0.2.12
type BackupHasPermanentBackupInFutureError struct {
// contains filtered or unexported fields
}
func NewBackupHasPermanentBackupInFutureError ¶ added in v0.2.12
func NewBackupHasPermanentBackupInFutureError(backupName string) BackupHasPermanentBackupInFutureError
type BackupNonExistenceError ¶
type BackupNonExistenceError struct {
// contains filtered or unexported fields
}
func NewBackupNonExistenceError ¶
func NewBackupNonExistenceError(backupName string) BackupNonExistenceError
func (BackupNonExistenceError) Error ¶
func (err BackupNonExistenceError) Error() string
type BackupSentinelDto ¶
type BackupSentinelDto struct { BackupStartLSN *uint64 `json:"LSN"` IncrementFromLSN *uint64 `json:"DeltaFromLSN,omitempty"` IncrementFrom *string `json:"DeltaFrom,omitempty"` IncrementFullName *string `json:"DeltaFullName,omitempty"` IncrementCount *int `json:"DeltaCount,omitempty"` Files BackupFileList `json:"Files"` TarFileSets map[string][]string `json:"TarFileSets"` PgVersion int `json:"PgVersion"` BackupFinishLSN *uint64 `json:"FinishLSN"` SystemIdentifier *uint64 `json:"SystemIdentifier,omitempty"` UncompressedSize int64 `json:"UncompressedSize"` CompressedSize int64 `json:"CompressedSize"` TablespaceSpec *TablespaceSpec `json:"Spec"` UserData interface{} `json:"UserData,omitempty"` }
BackupSentinelDto describes file structure of json sentinel
func (*BackupSentinelDto) IsIncremental ¶ added in v0.2.10
func (dto *BackupSentinelDto) IsIncremental() bool
TODO : unit tests TODO : get rid of panic here IsIncremental checks that sentinel represents delta backup
type BackupTime ¶
type BackupTime struct { BackupName string `json:"backup_name"` Time time.Time `json:"time"` WalFileName string `json:"wal_file_name"` }
BackupTime is used to sort backups by latest modified time.
type BgUploader ¶
type BgUploader struct {
// contains filtered or unexported fields
}
BgUploader represents the state of concurrent WAL upload
func NewBgUploader ¶
func NewBgUploader(walFilePath string, maxParallelWorkers int32, uploader *Uploader, preventWalOverwrite bool) *BgUploader
func (*BgUploader) Start ¶
func (bgUploader *BgUploader) Start()
Start up checking what's inside archive_status
type BlockLocationReader ¶
type BlockLocationReader struct {
// contains filtered or unexported fields
}
func NewBlockLocationReader ¶
func NewBlockLocationReader(underlying io.Reader) *BlockLocationReader
func (*BlockLocationReader) ReadNextLocation ¶
func (reader *BlockLocationReader) ReadNextLocation() (*walparser.BlockLocation, error)
ReadNextLocation returns any reader error wrapped with errors.Wrap
type BlockLocationWriter ¶
func NewBlockLocationWriter ¶
func NewBlockLocationWriter(underlying io.Writer) *BlockLocationWriter
func (*BlockLocationWriter) WriteLocation ¶
func (locationWriter *BlockLocationWriter) WriteLocation(location walparser.BlockLocation) error
type Bundle ¶
type Bundle struct { ArchiveDirectory string TarSizeThreshold int64 Sentinel *Sentinel TarBall TarBall TarBallMaker TarBallMaker Crypter crypto.Crypter Timeline uint32 Replica bool IncrementFromLsn *uint64 IncrementFromFiles BackupFileList DeltaMap PagedFileDeltaMap TablespaceSpec TablespaceSpec Files *sync.Map // contains filtered or unexported fields }
A Bundle represents the directory to be walked. Contains at least one TarBall if walk has started. Each TarBall except for the last one will be at least TarSizeThreshold bytes. The Sentinel is used to ensure complete uploaded backups; in this case, pg_control is used as the sentinel.
func NewBundle ¶
func NewBundle(archiveDirectory string, crypter crypto.Crypter, incrementFromLsn *uint64, incrementFromFiles BackupFileList) *Bundle
TODO: use DiskDataFolder
func (*Bundle) CheckSizeAndEnqueueBack ¶
func (*Bundle) DownloadDeltaMap ¶
func (*Bundle) EnqueueBack ¶
func (*Bundle) FinishQueue ¶
func (*Bundle) GetFileRelPath ¶
func (*Bundle) GetIncrementBaseFiles ¶
func (bundle *Bundle) GetIncrementBaseFiles() BackupFileList
GetIncrementBaseFiles returns list of Files from previous backup
func (*Bundle) GetIncrementBaseLsn ¶
GetIncrementBaseLsn returns LSN of previous backup
func (*Bundle) HandleWalkedFSObject ¶
TODO : unit tests HandleWalkedFSObject walks files provided by the passed in directory and creates compressed tar members labeled as `part_00i.tar.*`, where '*' is compressor file extension.
To see which files and directories are Skipped, please consult ExcludedFilenames. Excluded directories will be created but their contents will not be included in the tar bundle.
func (*Bundle) NewTarBall ¶
NewTarBall starts writing new tarball
func (*Bundle) PrefaultWalkedFSObject ¶
TODO : unit tests
func (*Bundle) StartBackup ¶
func (bundle *Bundle) StartBackup(conn *pgx.Conn, backup string) (backupName string, lsn uint64, version int, dataDir string, systemIdentifier *uint64, err error)
TODO : unit tests StartBackup starts a non-exclusive base backup immediately. When finishing the backup, `backup_label` and `tablespace_map` contents are not immediately written to a file but returned instead. Returns empty string and an error if backup fails.
func (*Bundle) StartQueue ¶
func (*Bundle) UploadLabelFiles ¶
TODO : unit tests UploadLabelFiles creates the `backup_label` and `tablespace_map` files by stopping the backup and uploads them to S3.
func (*Bundle) UploadPgControl ¶
TODO : unit tests UploadPgControl should only be called after the rest of the backup is successfully uploaded to S3.
type BytesPerWalSegmentError ¶
type BytesPerWalSegmentError struct {
// contains filtered or unexported fields
}
func NewBytesPerWalSegmentError ¶
func NewBytesPerWalSegmentError() BytesPerWalSegmentError
func (BytesPerWalSegmentError) Error ¶
func (err BytesPerWalSegmentError) Error() string
type CachedDecompressor ¶ added in v0.2.10
type CachedDecompressor struct {
FileExtension string
}
CachedDecompressor is the file extension describing decompressor
type CantDiscardWalDataError ¶
type CantDiscardWalDataError struct {
// contains filtered or unexported fields
}
func NewCantDiscardWalDataError ¶
func NewCantDiscardWalDataError() CantDiscardWalDataError
func (CantDiscardWalDataError) Error ¶
func (err CantDiscardWalDataError) Error() string
type CantOverwriteWalFileError ¶
type CantOverwriteWalFileError struct {
// contains filtered or unexported fields
}
func NewCantOverwriteWalFileError ¶
func NewCantOverwriteWalFileError(walFilePath string) CantOverwriteWalFileError
func (CantOverwriteWalFileError) Error ¶
func (err CantOverwriteWalFileError) Error() string
type CascadeWriteCloser ¶
type CascadeWriteCloser struct { io.WriteCloser Underlying io.Closer }
CascadeWriteCloser bundles multiple closures into one function. Calling Close() will close the main and underlying writers.
func (*CascadeWriteCloser) Close ¶
func (cascadeCloser *CascadeWriteCloser) Close() error
Close returns the first encountered error from closing main or underlying writer.
type Cleaner ¶
Cleaner interface serves to separate file system logic from prefetch clean logic to make it testable
type CompressAndEncryptError ¶ added in v0.2.10
type CompressAndEncryptError struct {
// contains filtered or unexported fields
}
CompressAndEncryptError is used to catch specific errors from CompressAndEncrypt when uploading to Storage. Will not retry upload if this error occurs.
func NewCompressingPipeWriterError ¶
func NewCompressingPipeWriterError(reason string) CompressAndEncryptError
func (CompressAndEncryptError) Error ¶ added in v0.2.10
func (err CompressAndEncryptError) Error() string
type DataFolder ¶
type DataFolder interface { // OpenReadonlyFile should return NoSuchFileError if it cannot find desired file OpenReadonlyFile(filename string) (io.ReadCloser, error) OpenWriteOnlyFile(filename string) (io.WriteCloser, error) CleanFolder() error FileExists(filename string) bool DeleteFile(filename string) error CreateFile(filename string) error }
func ConfigureArchiveStatusManager ¶ added in v0.2.14
func ConfigureArchiveStatusManager() (DataFolder, error)
TODO : unit tests
type DataFolderASM ¶ added in v0.2.14
type DataFolderASM struct {
// contains filtered or unexported fields
}
func NewDataFolderASM ¶ added in v0.2.14
func NewDataFolderASM(folder DataFolder) DataFolderASM
type DeltaFile ¶
type DeltaFile struct { Locations []walparser.BlockLocation WalParser *walparser.WalParser }
type DeltaFileChanWriter ¶
type DeltaFileChanWriter struct { DeltaFile *DeltaFile BlockLocationConsumer chan walparser.BlockLocation }
func NewDeltaFileChanWriter ¶
func NewDeltaFileChanWriter(deltaFile *DeltaFile) *DeltaFileChanWriter
func (*DeltaFileChanWriter) Consume ¶
func (writer *DeltaFileChanWriter) Consume(waitGroup *sync.WaitGroup)
type DeltaFileManager ¶
type DeltaFileManager struct { PartFiles *LazyCache DeltaFileWriters *LazyCache CanceledDeltaFiles map[string]bool // contains filtered or unexported fields }
func NewDeltaFileManager ¶
func NewDeltaFileManager(dataFolder DataFolder) *DeltaFileManager
func (*DeltaFileManager) CancelRecording ¶
func (manager *DeltaFileManager) CancelRecording(walFilename string)
func (*DeltaFileManager) CombinePartFile ¶
func (manager *DeltaFileManager) CombinePartFile(deltaFilename string, partFile *WalPartFile) error
func (*DeltaFileManager) FlushDeltaFiles ¶
func (manager *DeltaFileManager) FlushDeltaFiles(uploader *Uploader, completedPartFiles map[string]bool)
func (*DeltaFileManager) FlushFiles ¶
func (manager *DeltaFileManager) FlushFiles(uploader *Uploader)
func (*DeltaFileManager) FlushPartFiles ¶
func (manager *DeltaFileManager) FlushPartFiles() (completedPartFiles map[string]bool)
func (*DeltaFileManager) GetBlockLocationConsumer ¶
func (manager *DeltaFileManager) GetBlockLocationConsumer(deltaFilename string) (chan walparser.BlockLocation, error)
func (*DeltaFileManager) GetPartFile ¶
func (manager *DeltaFileManager) GetPartFile(deltaFilename string) (*WalPartFile, error)
func (*DeltaFileManager) LoadDeltaFileWriter ¶
func (manager *DeltaFileManager) LoadDeltaFileWriter(deltaFilename string) (deltaFileWriter *DeltaFileChanWriter, err error)
TODO : unit tests
func (*DeltaFileManager) LoadPartFile ¶
func (manager *DeltaFileManager) LoadPartFile(partFilename string) (*WalPartFile, error)
TODO : unit tests
type DeltaFileWriterNotFoundError ¶
type DeltaFileWriterNotFoundError struct {
// contains filtered or unexported fields
}
func NewDeltaFileWriterNotFoundError ¶
func NewDeltaFileWriterNotFoundError(filename string) DeltaFileWriterNotFoundError
func (DeltaFileWriterNotFoundError) Error ¶
func (err DeltaFileWriterNotFoundError) Error() string
type DeltaNo ¶ added in v0.2.12
type DeltaNo uint64
func NewDeltaNoFromFilename ¶ added in v0.2.12
func NewDeltaNoFromFilenameNoError ¶ added in v0.2.12
func NewDeltaNoFromLsn ¶ added in v0.2.12
func NewDeltaNoFromWalSegmentNo ¶ added in v0.2.12
func NewDeltaNoFromWalSegmentNo(walSegmentNo WalSegmentNo) DeltaNo
func (DeltaNo) FirstWalSegmentNo ¶ added in v0.2.12
func (deltaNo DeltaNo) FirstWalSegmentNo() WalSegmentNo
func (DeltaNo) GetFilename ¶ added in v0.2.12
type DiskDataFolder ¶
type DiskDataFolder struct {
// contains filtered or unexported fields
}
func NewDiskDataFolder ¶
func NewDiskDataFolder(folderPath string) (*DiskDataFolder, error)
func (*DiskDataFolder) CleanFolder ¶
func (folder *DiskDataFolder) CleanFolder() error
func (*DiskDataFolder) CreateFile ¶ added in v0.2.10
func (folder *DiskDataFolder) CreateFile(filename string) error
func (*DiskDataFolder) DeleteFile ¶ added in v0.2.10
func (folder *DiskDataFolder) DeleteFile(filename string) error
func (*DiskDataFolder) FileExists ¶ added in v0.2.10
func (folder *DiskDataFolder) FileExists(filename string) bool
func (*DiskDataFolder) OpenReadonlyFile ¶
func (folder *DiskDataFolder) OpenReadonlyFile(filename string) (io.ReadCloser, error)
func (*DiskDataFolder) OpenWriteOnlyFile ¶
func (folder *DiskDataFolder) OpenWriteOnlyFile(filename string) (io.WriteCloser, error)
type EmptyWriteIgnorer ¶
type EmptyWriteIgnorer struct {
io.WriteCloser
}
EmptyWriteIgnorer handles 0 byte write in LZ4 package to stop pipe reader/writer from blocking.
type ExponentialRetrier ¶
type ExponentialRetrier struct {
// contains filtered or unexported fields
}
func NewExponentialRetrier ¶
func NewExponentialRetrier(startSleepDuration, sleepDurationBound time.Duration) *ExponentialRetrier
type ExtendedMetadataDto ¶ added in v0.2.10
type ExtendedMetadataDto struct { StartTime time.Time `json:"start_time"` FinishTime time.Time `json:"finish_time"` DatetimeFormat string `json:"date_fmt"` Hostname string `json:"hostname"` DataDir string `json:"data_dir"` PgVersion int `json:"pg_version"` StartLsn uint64 `json:"start_lsn"` FinishLsn uint64 `json:"finish_lsn"` IsPermanent bool `json:"is_permanent"` SystemIdentifier *uint64 `json:"system_identifier"` UncompressedSize int64 `json:"uncompressed_size"` CompressedSize int64 `json:"compressed_size"` UserData interface{} `json:"user_data,omitempty"` }
Extended metadata should describe backup in more details, but be small enough to be downloaded often
type FileSystemCleaner ¶
type FileSystemCleaner struct{}
FileSystemCleaner actually performs it's functions on file system
type FileTarInterpreter ¶
type FileTarInterpreter struct { DBDataDirectory string Sentinel BackupSentinelDto FilesToUnwrap map[string]bool }
FileTarInterpreter extracts input to disk.
func NewFileTarInterpreter ¶
func NewFileTarInterpreter(dbDataDirectory string, sentinel BackupSentinelDto, filesToUnwrap map[string]bool) *FileTarInterpreter
func (*FileTarInterpreter) Interpret ¶
func (tarInterpreter *FileTarInterpreter) Interpret(fileReader io.Reader, fileInfo *tar.Header) error
Interpret extracts a tar file to disk and creates needed directories. Returns the first error encountered. Calls fsync after each file is written successfully.
type IncorrectLogSegNoError ¶
type IncorrectLogSegNoError struct {
// contains filtered or unexported fields
}
func NewIncorrectLogSegNoError ¶
func NewIncorrectLogSegNoError(name string) IncorrectLogSegNoError
func (IncorrectLogSegNoError) Error ¶
func (err IncorrectLogSegNoError) Error() string
type IncrementalPageReader ¶
type IncrementalPageReader struct { PagedFile ioextensions.ReadSeekCloser FileSize int64 Lsn uint64 Next []byte Blocks []uint32 }
IncrementalPageReader constructs difference map during initialization and than re-read file Diff map may consist of 1Gb/PostgresBlockSize elements == 512Kb
func (*IncrementalPageReader) AdvanceFileReader ¶
func (pageReader *IncrementalPageReader) AdvanceFileReader() error
func (*IncrementalPageReader) Close ¶
func (pageReader *IncrementalPageReader) Close() error
Close IncrementalPageReader
func (*IncrementalPageReader) DeltaBitmapInitialize ¶
func (pageReader *IncrementalPageReader) DeltaBitmapInitialize(deltaBitmap *roaring.Bitmap)
func (*IncrementalPageReader) DrainMoreData ¶
func (pageReader *IncrementalPageReader) DrainMoreData() (succeed bool, err error)
func (*IncrementalPageReader) FullScanInitialize ¶
func (pageReader *IncrementalPageReader) FullScanInitialize() error
func (*IncrementalPageReader) Read ¶
func (pageReader *IncrementalPageReader) Read(p []byte) (n int, err error)
func (*IncrementalPageReader) SelectNewValidPage ¶
func (pageReader *IncrementalPageReader) SelectNewValidPage(pageBytes []byte, blockNo uint32) (valid bool)
SelectNewValidPage checks whether page is valid and if it so, then blockNo is appended to Blocks list
func (*IncrementalPageReader) WriteDiffMapToHeader ¶
func (pageReader *IncrementalPageReader) WriteDiffMapToHeader(headerWriter io.Writer)
WriteDiffMapToHeader is currently used only with buffers, so we don't handle any writing errors
type InvalidBlockError ¶
type InvalidBlockError struct {
// contains filtered or unexported fields
}
InvalidBlockError indicates that file contain invalid page and cannot be archived incrementally
func NewInvalidBlockError ¶
func NewInvalidBlockError(blockNo uint32) InvalidBlockError
func (InvalidBlockError) Error ¶
func (err InvalidBlockError) Error() string
type InvalidConcurrencyValueError ¶ added in v0.2.10
type InvalidConcurrencyValueError struct {
// contains filtered or unexported fields
}
func NewInvalidConcurrencyValueError ¶ added in v0.2.10
func NewInvalidConcurrencyValueError(concurrencyType string, value int) InvalidConcurrencyValueError
func (InvalidConcurrencyValueError) Error ¶ added in v0.2.10
func (err InvalidConcurrencyValueError) Error() string
type InvalidIncrementFileHeaderError ¶
type InvalidIncrementFileHeaderError struct {
// contains filtered or unexported fields
}
func NewInvalidIncrementFileHeaderError ¶
func NewInvalidIncrementFileHeaderError() InvalidIncrementFileHeaderError
func (InvalidIncrementFileHeaderError) Error ¶
func (err InvalidIncrementFileHeaderError) Error() string
type InvalidWalFileMagicError ¶
type InvalidWalFileMagicError struct {
// contains filtered or unexported fields
}
func NewInvalidWalFileMagicError ¶
func NewInvalidWalFileMagicError() InvalidWalFileMagicError
func (InvalidWalFileMagicError) Error ¶
func (err InvalidWalFileMagicError) Error() string
type LazyCache ¶
type LazyCache struct {
// contains filtered or unexported fields
}
func NewLazyCache ¶
func (*LazyCache) LoadExisting ¶
type LogFetchHandlers ¶ added in v0.2.12
type LogFetchSettings ¶ added in v0.2.12
type NOPTarBall ¶
type NOPTarBall struct {
// contains filtered or unexported fields
}
NOPTarBall mocks a tarball. Used for prefault logic.
func (*NOPTarBall) AddSize ¶
func (tarBall *NOPTarBall) AddSize(i int64)
func (*NOPTarBall) AwaitUploads ¶
func (tarBall *NOPTarBall) AwaitUploads()
func (*NOPTarBall) CloseTar ¶
func (tarBall *NOPTarBall) CloseTar() error
func (*NOPTarBall) SetUp ¶
func (tarBall *NOPTarBall) SetUp(crypter crypto.Crypter, params ...string)
func (*NOPTarBall) Size ¶
func (tarBall *NOPTarBall) Size() int64
func (*NOPTarBall) TarWriter ¶
func (tarBall *NOPTarBall) TarWriter() *tar.Writer
type NOPTarBallMaker ¶
type NOPTarBallMaker struct {
// contains filtered or unexported fields
}
NOPTarBallMaker creates a new NOPTarBall. Used for testing purposes.
func (*NOPTarBallMaker) Make ¶
func (tarBallMaker *NOPTarBallMaker) Make(inheritState bool) TarBall
Make creates a new NOPTarBall.
type NamedReader ¶
type NamedReaderImpl ¶
func NewNamedReaderImpl ¶ added in v0.2.10
func NewNamedReaderImpl(reader io.Reader, name string) *NamedReaderImpl
func (*NamedReaderImpl) Name ¶
func (reader *NamedReaderImpl) Name() string
type NilWalParserError ¶
type NilWalParserError struct {
// contains filtered or unexported fields
}
func NewNilWalParserError ¶
func NewNilWalParserError() NilWalParserError
func (NilWalParserError) Error ¶
func (err NilWalParserError) Error() string
type NoBackupsFoundError ¶
type NoBackupsFoundError struct {
// contains filtered or unexported fields
}
func NewNoBackupsFoundError ¶
func NewNoBackupsFoundError() NoBackupsFoundError
func (NoBackupsFoundError) Error ¶
func (err NoBackupsFoundError) Error() string
type NoBitmapFoundError ¶
type NoBitmapFoundError struct {
// contains filtered or unexported fields
}
func NewNoBitmapFoundError ¶
func NewNoBitmapFoundError() NoBitmapFoundError
func (NoBitmapFoundError) Error ¶
func (err NoBitmapFoundError) Error() string
type NoFilesToExtractError ¶
type NoFilesToExtractError struct {
// contains filtered or unexported fields
}
func NewNoFilesToExtractError ¶
func NewNoFilesToExtractError() NoFilesToExtractError
func (NoFilesToExtractError) Error ¶
func (err NoFilesToExtractError) Error() string
type NoPostgresVersionError ¶
type NoPostgresVersionError struct {
// contains filtered or unexported fields
}
func NewNoPostgresVersionError ¶
func NewNoPostgresVersionError() NoPostgresVersionError
func (NoPostgresVersionError) Error ¶
func (err NoPostgresVersionError) Error() string
type NoSuchFileError ¶
type NoSuchFileError struct {
// contains filtered or unexported fields
}
func NewNoSuchFileError ¶
func NewNoSuchFileError(filename string) NoSuchFileError
func (NoSuchFileError) Error ¶
func (err NoSuchFileError) Error() string
type NonEmptyDbDataDirectoryError ¶
type NonEmptyDbDataDirectoryError struct {
// contains filtered or unexported fields
}
func NewNonEmptyDbDataDirectoryError ¶
func NewNonEmptyDbDataDirectoryError(dbDataDirectory string) NonEmptyDbDataDirectoryError
func (NonEmptyDbDataDirectoryError) Error ¶
func (err NonEmptyDbDataDirectoryError) Error() string
type NotWalFilenameError ¶
type NotWalFilenameError struct {
// contains filtered or unexported fields
}
func NewNotWalFilenameError ¶
func NewNotWalFilenameError(filename string) NotWalFilenameError
func (NotWalFilenameError) Error ¶
func (err NotWalFilenameError) Error() string
type PagedFileDeltaMap ¶
type PagedFileDeltaMap map[walparser.RelFileNode]*roaring.Bitmap
func GetDeltaMap ¶ added in v0.2.12
func NewPagedFileDeltaMap ¶
func NewPagedFileDeltaMap() PagedFileDeltaMap
func (*PagedFileDeltaMap) AddLocationToDelta ¶ added in v0.2.12
func (deltaMap *PagedFileDeltaMap) AddLocationToDelta(location walparser.BlockLocation)
func (*PagedFileDeltaMap) AddLocationsToDelta ¶ added in v0.2.12
func (deltaMap *PagedFileDeltaMap) AddLocationsToDelta(locations []walparser.BlockLocation)
func (*PagedFileDeltaMap) GetDeltaBitmapFor ¶
func (deltaMap *PagedFileDeltaMap) GetDeltaBitmapFor(filePath string) (*roaring.Bitmap, error)
TODO : unit test no bitmap found
func (*PagedFileDeltaMap) GetLocationsFromDeltas ¶ added in v0.2.12
func (*PagedFileDeltaMap) GetLocationsFromWals ¶ added in v0.2.12
func (deltaMap *PagedFileDeltaMap) GetLocationsFromWals(folder storage.Folder, timeline uint32, first, last WalSegmentNo, walParser *walparser.WalParser) error
type PgControlNotFoundError ¶
type PgControlNotFoundError struct {
// contains filtered or unexported fields
}
func NewPgControlNotFoundError ¶
func NewPgControlNotFoundError() PgControlNotFoundError
func (PgControlNotFoundError) Error ¶
func (err PgControlNotFoundError) Error() string
type PgQueryRunner ¶
type PgQueryRunner struct { Version int SystemIdentifier *uint64 // contains filtered or unexported fields }
PgQueryRunner is implementation for controlling PostgreSQL 9.0+
func NewPgQueryRunner ¶
func NewPgQueryRunner(conn *pgx.Conn) (*PgQueryRunner, error)
NewPgQueryRunner builds QueryRunner from available connection
func (*PgQueryRunner) BuildGetSystemIdentifier ¶ added in v0.2.13
func (queryRunner *PgQueryRunner) BuildGetSystemIdentifier() string
func (*PgQueryRunner) BuildGetVersion ¶
func (queryRunner *PgQueryRunner) BuildGetVersion() string
BuildGetVersion formats a query to retrieve PostgreSQL numeric version
func (*PgQueryRunner) BuildStartBackup ¶
func (queryRunner *PgQueryRunner) BuildStartBackup() (string, error)
BuildStartBackup formats a query that starts backup according to server features and version
func (*PgQueryRunner) BuildStopBackup ¶
func (queryRunner *PgQueryRunner) BuildStopBackup() (string, error)
BuildStopBackup formats a query that stops backup according to server features and version
func (*PgQueryRunner) StartBackup ¶
func (queryRunner *PgQueryRunner) StartBackup(backup string) (backupName string, lsnString string, inRecovery bool, dataDir string, err error)
StartBackup informs the database that we are starting copy of cluster contents
func (*PgQueryRunner) StopBackup ¶
func (queryRunner *PgQueryRunner) StopBackup() (label string, offsetMap string, lsnStr string, err error)
StopBackup informs the database that copy is over
type PostgresPageHeader ¶
type PostgresPageHeader struct {
// contains filtered or unexported fields
}
func ParsePostgresPageHeader ¶
func ParsePostgresPageHeader(reader io.Reader) (*PostgresPageHeader, error)
ParsePostgresPageHeader reads information from PostgreSQL page header. Exported for test reasons.
func (*PostgresPageHeader) IsNew ¶
func (header *PostgresPageHeader) IsNew() bool
func (*PostgresPageHeader) IsValid ¶
func (header *PostgresPageHeader) IsValid() bool
func (*PostgresPageHeader) Lsn ¶
func (header *PostgresPageHeader) Lsn() uint64
type QueryRunner ¶
type QueryRunner interface { // This call should inform the database that we are going to copy cluster's contents // Should fail if backup is currently impossible StartBackup(backup string) (string, string, bool, error) // Inform database that contents are copied, get information on backup StopBackup() (string, string, string, error) }
The QueryRunner interface for controlling database during backup
type ReaderMaker ¶
type ReaderMaker interface { Reader() (io.ReadCloser, error) Path() string }
ReaderMaker is the generic interface used by extract. It allows for ease of handling different file formats.
type SentinelMarshallingError ¶ added in v0.2.7
type SentinelMarshallingError struct {
// contains filtered or unexported fields
}
func NewSentinelMarshallingError ¶ added in v0.2.7
func NewSentinelMarshallingError(sentinelName string, err error) SentinelMarshallingError
func (SentinelMarshallingError) Error ¶ added in v0.2.7
func (err SentinelMarshallingError) Error() string
type StorageAdapter ¶ added in v0.2.7
type StorageAdapter struct {
// contains filtered or unexported fields
}
type StorageReaderMaker ¶
StorageReaderMaker creates readers for downloading from storage
func NewStorageReaderMaker ¶
func NewStorageReaderMaker(folder storage.Folder, relativePath string) *StorageReaderMaker
func (*StorageReaderMaker) Path ¶
func (readerMaker *StorageReaderMaker) Path() string
func (*StorageReaderMaker) Reader ¶
func (readerMaker *StorageReaderMaker) Reader() (io.ReadCloser, error)
type StorageTarBall ¶
type StorageTarBall struct {
// contains filtered or unexported fields
}
StorageTarBall represents a tar file that is going to be uploaded to storage.
func (*StorageTarBall) AddSize ¶
func (tarBall *StorageTarBall) AddSize(i int64)
AddSize to total Size
func (*StorageTarBall) AwaitUploads ¶
func (tarBall *StorageTarBall) AwaitUploads()
func (*StorageTarBall) CloseTar ¶
func (tarBall *StorageTarBall) CloseTar() error
CloseTar closes the tar writer, flushing any unwritten data to the underlying writer before also closing the underlying writer.
func (*StorageTarBall) SetUp ¶
func (tarBall *StorageTarBall) SetUp(crypter crypto.Crypter, names ...string)
SetUp creates a new tar writer and starts upload to storage. Upload will block until the tar file is finished writing. If a name for the file is not given, default name is of the form `part_....tar.[Compressor file extension]`.
func (*StorageTarBall) Size ¶
func (tarBall *StorageTarBall) Size() int64
Size accumulated in this tarball
func (*StorageTarBall) TarWriter ¶
func (tarBall *StorageTarBall) TarWriter() *tar.Writer
type StorageTarBallMaker ¶
type StorageTarBallMaker struct {
// contains filtered or unexported fields
}
StorageTarBallMaker creates tarballs that are uploaded to storage.
func NewStorageTarBallMaker ¶
func NewStorageTarBallMaker(backupName string, uploader *Uploader) *StorageTarBallMaker
func (*StorageTarBallMaker) Make ¶
func (tarBallMaker *StorageTarBallMaker) Make(dedicatedUploader bool) TarBall
Make returns a tarball with required storage fields.
type TablespaceLocation ¶ added in v0.2.13
type TablespaceSpec ¶ added in v0.2.13
type TablespaceSpec struct {
// contains filtered or unexported fields
}
The mandatory keys for this map are "base_prefix" and "tablespaces". "base_prefix" contains Location of pg_data folder. "tablespaces" contains array of keys, which also happen to be names of tablespace folders. The rest keys should be these names of tablespace folders and values should be TablespaceLocation structs.
func NewTablespaceSpec ¶ added in v0.2.13
func NewTablespaceSpec(basePrefix string) TablespaceSpec
func (*TablespaceSpec) AddTablespace ¶ added in v0.2.13
func (spec *TablespaceSpec) AddTablespace(symlinkName string, actualLocation string)
func (*TablespaceSpec) BasePrefix ¶ added in v0.2.13
func (spec *TablespaceSpec) BasePrefix() (string, bool)
func (*TablespaceSpec) Empty ¶ added in v0.2.13
func (spec *TablespaceSpec) Empty() bool
func (*TablespaceSpec) IsTablespaceSymlink ¶ added in v0.2.13
func (spec *TablespaceSpec) IsTablespaceSymlink(path string) (bool, error)
func (*TablespaceSpec) Length ¶ added in v0.2.13
func (spec *TablespaceSpec) Length() int
func (*TablespaceSpec) Location ¶ added in v0.2.13
func (spec *TablespaceSpec) Location(symlinkName string) (TablespaceLocation, bool)
func (*TablespaceSpec) MakeTablespaceSymlinkPath ¶ added in v0.2.13
func (spec *TablespaceSpec) MakeTablespaceSymlinkPath(path string) (string, error)
func (*TablespaceSpec) MarshalJSON ¶ added in v0.2.13
func (spec *TablespaceSpec) MarshalJSON() ([]byte, error)
func (*TablespaceSpec) SetBasePrefix ¶ added in v0.2.13
func (spec *TablespaceSpec) SetBasePrefix(basePrefix string)
func (*TablespaceSpec) TablespaceLocations ¶ added in v0.2.13
func (spec *TablespaceSpec) TablespaceLocations() []TablespaceLocation
func (*TablespaceSpec) TablespaceNames ¶ added in v0.2.13
func (spec *TablespaceSpec) TablespaceNames() []string
func (*TablespaceSpec) UnmarshalJSON ¶ added in v0.2.13
func (spec *TablespaceSpec) UnmarshalJSON(b []byte) error
type TarBall ¶
type TarBall interface { SetUp(crypter crypto.Crypter, args ...string) CloseTar() error Size() int64 AddSize(int64) TarWriter() *tar.Writer AwaitUploads() }
A TarBall represents one tar file.
type TarBallMaker ¶
TarBallMaker is used to allow for flexible creation of different TarBalls.
func NewNopTarBallMaker ¶
func NewNopTarBallMaker() TarBallMaker
type TarInterpreter ¶
TarInterpreter behaves differently for different file types.
type TarSizeError ¶
type TarSizeError struct {
// contains filtered or unexported fields
}
func NewTarSizeError ¶
func NewTarSizeError(packedFileSize, expectedSize int64) TarSizeError
func (TarSizeError) Error ¶
func (err TarSizeError) Error() string
type UnconfiguredStorageError ¶ added in v0.2.8
type UnconfiguredStorageError struct {
// contains filtered or unexported fields
}
func NewUnconfiguredStorageError ¶ added in v0.2.8
func NewUnconfiguredStorageError(storagePrefixVariants []string) UnconfiguredStorageError
func (UnconfiguredStorageError) Error ¶ added in v0.2.8
func (err UnconfiguredStorageError) Error() string
type UnexpectedTarDataError ¶
type UnexpectedTarDataError struct {
// contains filtered or unexported fields
}
func NewUnexpectedTarDataError ¶
func NewUnexpectedTarDataError() UnexpectedTarDataError
func (UnexpectedTarDataError) Error ¶
func (err UnexpectedTarDataError) Error() string
type UnknownCompressionMethodError ¶
type UnknownCompressionMethodError struct {
// contains filtered or unexported fields
}
func NewUnknownCompressionMethodError ¶
func NewUnknownCompressionMethodError() UnknownCompressionMethodError
func (UnknownCompressionMethodError) Error ¶
func (err UnknownCompressionMethodError) Error() string
type UnknownIncrementFileHeaderError ¶
type UnknownIncrementFileHeaderError struct {
// contains filtered or unexported fields
}
func NewUnknownIncrementFileHeaderError ¶
func NewUnknownIncrementFileHeaderError() UnknownIncrementFileHeaderError
func (UnknownIncrementFileHeaderError) Error ¶
func (err UnknownIncrementFileHeaderError) Error() string
type UnknownTableSpaceError ¶
type UnknownTableSpaceError struct {
// contains filtered or unexported fields
}
func NewUnknownTableSpaceError ¶
func NewUnknownTableSpaceError() UnknownTableSpaceError
func (UnknownTableSpaceError) Error ¶
func (err UnknownTableSpaceError) Error() string
type UnmarshallingError ¶ added in v0.2.10
type UnmarshallingError struct {
// contains filtered or unexported fields
}
func NewUnmarshallingError ¶ added in v0.2.10
func NewUnmarshallingError(subject string, err error) UnmarshallingError
func (UnmarshallingError) Error ¶ added in v0.2.10
func (err UnmarshallingError) Error() string
type UnsetRequiredSettingError ¶ added in v0.2.10
type UnsetRequiredSettingError struct {
// contains filtered or unexported fields
}
func NewUnsetRequiredSettingError ¶ added in v0.2.10
func NewUnsetRequiredSettingError(settingName string) UnsetRequiredSettingError
func (UnsetRequiredSettingError) Error ¶ added in v0.2.10
func (err UnsetRequiredSettingError) Error() string
type UnsupportedFileTypeError ¶
type UnsupportedFileTypeError struct {
// contains filtered or unexported fields
}
UnsupportedFileTypeError is used to signal file types that are unsupported by WAL-G.
func NewUnsupportedFileTypeError ¶
func NewUnsupportedFileTypeError(path string, fileFormat string) UnsupportedFileTypeError
func (UnsupportedFileTypeError) Error ¶ added in v0.2.8
func (err UnsupportedFileTypeError) Error() string
type UnsupportedPostgresVersionError ¶
type UnsupportedPostgresVersionError struct {
// contains filtered or unexported fields
}
func NewUnsupportedPostgresVersionError ¶
func NewUnsupportedPostgresVersionError(version int) UnsupportedPostgresVersionError
func (UnsupportedPostgresVersionError) Error ¶
func (err UnsupportedPostgresVersionError) Error() string
type UploadObject ¶ added in v0.2.10
UploadObject
func GetMarkedBackupMetadataToUpload ¶ added in v0.2.12
func GetMarkedBackupMetadataToUpload( folder storage.Folder, backupName string, toPermanent bool) ([]UploadObject, error)
GetMarkedBackupMetadataToUpload retrieves all previous permanent or impermanent backup metas, including itself, any previous delta backups and initial full backup, in increasing order beginning from full backup, returning modified metadata ready to be uploaded
For example, when marking backups from impermanent to permanent, we retrieve all currently impermanent backup metadata, set them to permanent, and return the modified metadata as a slice of uploadable objects
type Uploader ¶
type Uploader struct { UploadingFolder storage.Folder Compressor compression.Compressor ArchiveStatusManager ArchiveStatusManager Failed atomic.Value // contains filtered or unexported fields }
Uploader contains fields associated with uploading tarballs. Multiple tarballs can share one uploader.
func ConfigureMockUploaderWithoutCompressMethod ¶ added in v0.2.14
func ConfigureUploader ¶ added in v0.2.8
ConfigureUploader connects to storage and creates an uploader. It makes sure that a valid session has started; if invalid, returns AWS error and `<nil>` values.
func NewUploader ¶
func NewUploader( compressor compression.Compressor, uploadingLocation storage.Folder, deltaFileManager *DeltaFileManager, ) *Uploader
func (*Uploader) PushStream ¶ added in v0.2.10
TODO : unit tests PushStream compresses a stream and push it
func (*Uploader) PushStreamToDestination ¶ added in v0.2.10
TODO : unit tests PushStreamToDestination compresses a stream and push it to specifyed destination
func (*Uploader) UploadFile ¶
func (uploader *Uploader) UploadFile(file NamedReader) error
TODO : unit tests UploadFile compresses a file and uploads it.
func (*Uploader) UploadMultiple ¶ added in v0.2.10
func (uploader *Uploader) UploadMultiple(objects []UploadObject) error
UploadMultiple uploads multiple objects from the start of the slice, returning the first error if any. Note that this operation is not atomic TODO : unit tests
func (*Uploader) UploadWalFile ¶
func (uploader *Uploader) UploadWalFile(file NamedReader) error
TODO : unit tests
type WalDeltaRecorder ¶
type WalDeltaRecorder struct {
// contains filtered or unexported fields
}
func NewWalDeltaRecorder ¶
func NewWalDeltaRecorder(blockLocationConsumer chan walparser.BlockLocation) *WalDeltaRecorder
type WalDeltaRecordingReader ¶
type WalDeltaRecordingReader struct { PageReader walparser.WalPageReader WalParser walparser.WalParser PageDataLeftover []byte Recorder *WalDeltaRecorder // contains filtered or unexported fields }
In case of recording error WalDeltaRecordingReader stops recording, but continues reading data correctly
func NewWalDeltaRecordingReader ¶
func NewWalDeltaRecordingReader(walFileReader io.Reader, walFilename string, manager *DeltaFileManager) (*WalDeltaRecordingReader, error)
func (*WalDeltaRecordingReader) Close ¶
func (reader *WalDeltaRecordingReader) Close() error
func (*WalDeltaRecordingReader) Read ¶
func (reader *WalDeltaRecordingReader) Read(p []byte) (n int, err error)
func (*WalDeltaRecordingReader) RecordBlockLocationsFromPage ¶
func (reader *WalDeltaRecordingReader) RecordBlockLocationsFromPage() error
type WalPart ¶
type WalPart struct {
// contains filtered or unexported fields
}
func NewWalPart ¶
func NewWalPart(dataType WalPartDataType, id uint8, data []byte) *WalPart
type WalPartDataType ¶
type WalPartDataType uint8
const ( PreviousWalHeadType WalPartDataType = 0 WalTailType WalPartDataType = 1 WalHeadType WalPartDataType = 2 )
type WalPartFile ¶
func LoadPartFile ¶
func LoadPartFile(reader io.Reader) (*WalPartFile, error)
func NewWalPartFile ¶
func NewWalPartFile() *WalPartFile
func (*WalPartFile) CombineRecords ¶
func (partFile *WalPartFile) CombineRecords() ([]walparser.XLogRecord, error)
func (*WalPartFile) IsComplete ¶
func (partFile *WalPartFile) IsComplete() bool
type WalPartRecorder ¶
type WalPartRecorder struct {
// contains filtered or unexported fields
}
func NewWalPartRecorder ¶
func NewWalPartRecorder(walFilename string, manager *DeltaFileManager) (*WalPartRecorder, error)
func (*WalPartRecorder) SaveNextWalHead ¶
func (recorder *WalPartRecorder) SaveNextWalHead(head []byte) error
func (*WalPartRecorder) SavePreviousWalTail ¶
func (recorder *WalPartRecorder) SavePreviousWalTail(tailData []byte) error
type WalSegmentNo ¶ added in v0.2.12
type WalSegmentNo uint64
func NewWalSegmentNo ¶ added in v0.2.12
func NewWalSegmentNo(lsn uint64) WalSegmentNo
func NewWalSegmentNoFromFilename ¶ added in v0.2.12
func NewWalSegmentNoFromFilename(filename string) (WalSegmentNo, error)
func NewWalSegmentNoFromFilenameNoError ¶ added in v0.2.12
func NewWalSegmentNoFromFilenameNoError(filename string) WalSegmentNo
func (WalSegmentNo) Add ¶ added in v0.2.12
func (walSegmentNo WalSegmentNo) Add(n uint64) WalSegmentNo
func (WalSegmentNo) FirstLsn ¶ added in v0.2.12
func (walSegmentNo WalSegmentNo) FirstLsn() uint64
func (WalSegmentNo) GetFilename ¶ added in v0.2.12
func (walSegmentNo WalSegmentNo) GetFilename(timeline uint32) string
func (WalSegmentNo) Next ¶ added in v0.2.12
func (walSegmentNo WalSegmentNo) Next() WalSegmentNo
func (WalSegmentNo) Previous ¶ added in v0.2.12
func (walSegmentNo WalSegmentNo) Previous() WalSegmentNo
func (WalSegmentNo) Sub ¶ added in v0.2.12
func (walSegmentNo WalSegmentNo) Sub(n uint64) WalSegmentNo
type WithSizeReader ¶ added in v0.2.13
type WithSizeReader struct {
// contains filtered or unexported fields
}
type WrongTypeError ¶
type WrongTypeError struct {
// contains filtered or unexported fields
}
func NewWrongTypeError ¶
func NewWrongTypeError(desiredType string) WrongTypeError
func (WrongTypeError) Error ¶
func (err WrongTypeError) Error() string
Source Files ¶
- archive_status_manager.go
- archive_status_manager_datafolder.go
- archive_status_manager_nop.go
- backup.go
- backup_detail.go
- backup_fetch_handler.go
- backup_file_description.go
- backup_list_handler.go
- backup_mark.go
- backup_mark_handler.go
- backup_push_handler.go
- backup_sentinel_dto.go
- backup_time.go
- bandwidth_limiter.go
- bguploader.go
- block_location_reader.go
- block_location_writer.go
- block_locations_util.go
- bundle.go
- cascade_closer.go
- cleaner.go
- compress_and_encrypt.go
- config.go
- configure.go
- connect.go
- data_folder.go
- delete_handler.go
- delta_file.go
- delta_file_chan_writer.go
- delta_file_manager.go
- delta_map_downloader.go
- delta_no.go
- disk_data_folder.go
- exponential_retrier.go
- extensions.go
- extract.go
- file_system_cleaner.go
- incremental_page_reader.go
- lazy_cache.go
- named_reader.go
- nop_tarball.go
- paged_file_delta_map.go
- pagefile.go
- postgres_page_header.go
- prefetch.go
- queryRunner.go
- reader_maker.go
- saver.go
- sentinel.go
- start_command.go
- storage_adapter.go
- storage_reader_maker.go
- storage_tar_ball.go
- storage_tar_ball_maker.go
- stream_fetch_helper.go
- stream_push_helper.go
- tablespace_spec.go
- tar_ball.go
- tar_ball_maker.go
- tar_interpreter.go
- timeline.go
- uploader.go
- wal_delta_recorder.go
- wal_delta_recording_reader.go
- wal_delta_util.go
- wal_fetch_handler.go
- wal_part.go
- wal_part_file.go
- wal_part_recorder.go
- wal_push_handler.go
- wal_segment_no.go
- with_size_reader.go