internal

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TarPartitionFolderName = "/tar_partitions/"
	PgControlPath          = "/global/pg_control"
)
View Source
const (
	PgControl             = "pg_control"
	BackupLabelFilename   = "backup_label"
	TablespaceMapFilename = "tablespace_map"
	TablespaceFolder      = "pg_tblspc"
)
View Source
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"
)
View Source
const (
	DefaultDataBurstRateLimit = 8 * int64(DatabasePageSize)
	DefaultDataFolderPath     = "/tmp"
	WaleFileHost              = "file://localhost"
)
View Source
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"
)
View Source
const (
	RelFileSizeBound               = 1 << 30
	BlocksInRelFile                = RelFileSizeBound / int(DatabasePageSize)
	DefaultSpcNode   walparser.Oid = 1663
)
View Source
const (
	DatabasePageSize = walparser.BlockSize

	SignatureMagicNumber byte = 0x55

	DefaultTablespace    = "base"
	GlobalTablespace     = "global"
	NonDefaultTablespace = "pg_tblspc"
)
View Source
const (
	BasePrefix  = "base_prefix"
	Tablespaces = "tablespaces"
)
View Source
const (
	WalFileInDelta      uint64 = 16
	DeltaFilenameSuffix        = "_delta"
	PartFilenameSuffix         = "_part"
)
View Source
const LatestString = "LATEST"
View Source
const MinAllowedConcurrency = 1
View Source
const (
	RecordPartFilename = "currentRecord.part"
)
View Source
const (
	StreamPrefix = "stream_"
)
View Source
const (
	// WalSegmentSize is the size of one WAL file
	WalSegmentSize = uint64(16 * 1024 * 1024) // xlog.c line 113ß

)

Variables

View Source
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,
	}
)
View Source
var BasePrefixMissingError = fmt.Errorf("Base prefix not set while working with tablespaces.\n")
View Source
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)
View Source
var DiskLimiter *rate.Limiter
View Source
var ExcludedFilenames = make(map[string]utility.Empty)

ExcludedFilenames is a list of excluded members from the bundled backup.

View Source
var Extensions []Extension
View Source
var IncrementFileHeader = []byte{'w', 'i', '1', SignatureMagicNumber}

"wi" at the head stands for "wal-g increment" format version "1", signature magic number

View Source
var MaxExtractRetryWait = 5 * time.Minute
View Source
var MinExtractRetryWait = time.Minute
View Source
var NetworkLimiter *rate.Limiter
View Source
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},
}
View Source
var StringModifiers = []string{"FULL", "FIND_FULL"}
View Source
var StringModifiersDeleteEverything = []string{"FORCE"}
View Source
var TerminalLocation = *walparser.NewBlockLocation(0, 0, 0, 0)
View Source
var UnwrapAll map[string]bool = nil
View Source
var UtilityFilePaths = map[string]bool{
	PgControlPath:         true,
	BackupLabelFilename:   true,
	TablespaceMapFilename: true,
}

Functions

func ApplyFileIncrement

func ApplyFileIncrement(fileName string, increment io.Reader) error

ApplyFileIncrement changes pages according to supplied change map file

func CheckPgVersionAndPgControl added in v0.2.14

func CheckPgVersionAndPgControl(archiveDirectory string)

func CleanupPrefetchDirectories

func CleanupPrefetchDirectories(walFileName string, location string, cleaner Cleaner)

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 Configure

func Configure()

func ConfigureCrypter added in v0.2.10

func ConfigureCrypter() crypto.Crypter

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

func ConfigureFolder() (storage.Folder, error)

TODO : unit tests

func ConfigureLimiters added in v0.2.8

func ConfigureLimiters()

TODO : unit tests

func ConfigureLogging added in v0.2.8

func ConfigureLogging() error

TODO : unit tests

func Connect

func Connect() (*pgx.Conn, error)

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 DeleteBeforeArgsValidator(cmd *cobra.Command, args []string) error

func DeleteBeforeTarget added in v0.2.10

func DeleteBeforeTarget(folder storage.Folder, target storage.Object,
	confirmed bool,
	isFullBackup func(object storage.Object) bool,
	less func(object1, object2 storage.Object) bool) error

func DeleteEverything added in v0.2.13

func DeleteEverything(folder storage.Folder,
	confirmed bool,
	args []string)

func DeleteEverythingArgsValidator added in v0.2.13

func DeleteEverythingArgsValidator(cmd *cobra.Command, args []string) error

func DeleteRetainArgsValidator added in v0.2.10

func DeleteRetainArgsValidator(cmd *cobra.Command, args []string) error

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

func DownloadAndDecompressWALFile(folder storage.Folder, walFileName string) (io.ReadCloser, error)

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

func DownloadWALFileTo(folder storage.Folder, walFileName string, dstPath string) error

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 FetchLogs added in v0.2.12

func FetchLogs(folder storage.Folder, startTS time.Time, endTS *time.Time, logFolderPath string, handlers LogFetchHandlers) (fetched []storage.Object, err error)

func FetchStreamSentinel added in v0.2.12

func FetchStreamSentinel(backup *Backup, sentinelDto interface{}) error

TODO : unit tests

func FileIsPiped added in v0.2.10

func FileIsPiped(stream *os.File) bool

FileIsPiped Check if file is piped

func FindTarget added in v0.2.10

func FindTarget(folder storage.Folder,
	compare func(object1, object2 storage.Object) bool,
	isTarget func(object storage.Object) bool) (storage.Object, error)

func FindTargetBeforeName added in v0.2.8

func FindTargetBeforeName(folder storage.Folder,
	name string, modifier int,
	isFullBackup func(object storage.Object) bool,
	greater func(object1, object2 storage.Object) bool) (storage.Object, error)

func FindTargetBeforeTime added in v0.2.10

func FindTargetBeforeTime(folder storage.Folder,
	timeLine time.Time, modifier int,
	isFullBackup func(object storage.Object) bool,
	less func(object1, object2 storage.Object) bool) (storage.Object, error)

func FindTargetRetain added in v0.2.10

func FindTargetRetain(folder storage.Folder,
	retentionCount, modifier int,
	isFullBackup func(object storage.Object) bool,
	greater func(object1, object2 storage.Object) bool) (storage.Object, error)

func GetBaseFilesToUnwrap

func GetBaseFilesToUnwrap(backupFileStates BackupFileList, currentFilesToUnwrap map[string]bool) (map[string]bool, error)

func GetBeforeChoiceFunc added in v0.2.10

func GetBeforeChoiceFunc(name string, modifier int,
	isFullBackup func(object storage.Object) bool) func(object storage.Object) bool

func GetDataFolderPath added in v0.2.10

func GetDataFolderPath() string

func GetDeltaFilenameFor

func GetDeltaFilenameFor(walFilename string) (string, error)

func GetDeltaRange added in v0.2.12

func GetDeltaRange(firstUsedLsn, firstNotUsedLsn uint64) (DeltaNo, DeltaNo)

func GetLastDecompressor added in v0.2.10

func GetLastDecompressor() (compression.Decompressor, error)

func GetLatestBackupName added in v0.2.7

func GetLatestBackupName(folder storage.Folder) (string, error)

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

func GetLogsDstSettings(operationLogsDstEnvVariable string) (dstFolder string, err error)

GetLogsDstSettings reads from the environment variables fetch settings

func GetMaxConcurrency added in v0.2.10

func GetMaxConcurrency(concurrencyType string) (int, error)

func GetMaxDownloadConcurrency added in v0.2.10

func GetMaxDownloadConcurrency() (int, error)

func GetMaxUploadConcurrency added in v0.2.10

func GetMaxUploadConcurrency() (int, error)

func GetMaxUploadDiskConcurrency added in v0.2.10

func GetMaxUploadDiskConcurrency() (int, error)

func GetMaxUploadQueue added in v0.2.10

func GetMaxUploadQueue() (int, error)

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

func GetNextWalFilename(name string) (string, error)

GetNextWalFilename computes name of next WAL segment

func GetPgFetcher added in v0.2.14

func GetPgFetcher(dbDataDirectory, fileMask, restoreSpecPath string) func(folder storage.Folder, backup Backup)

func GetPositionInDelta

func GetPositionInDelta(walFilename string) int

func GetPrefetchLocations

func GetPrefetchLocations(location string, walFileName string) (prefetchLocation string, runningLocation string, runningFile string, fetchedFile string)

func GetRelFileIdFrom

func GetRelFileIdFrom(filePath string) (int, error)

func GetRelFileNodeFrom

func GetRelFileNodeFrom(filePath string) (*walparser.RelFileNode, error)

func GetRetainChoiceFunc added in v0.2.10

func GetRetainChoiceFunc(retentionCount, modifier int,
	isFullBackup func(object storage.Object) bool) func(object storage.Object) bool

func GetSentinelUserData

func GetSentinelUserData() interface{}

func GetSetting added in v0.2.10

func GetSetting(key string) (value string, ok bool)

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 GetWaleCompatibleSetting(key string) (value string, exists bool)

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

func HandleBackupList(folder storage.Folder)

TODO : unit tests HandleBackupList is invoked to perform wal-g backup-list

func HandleBackupListWithFlags added in v0.2.10

func HandleBackupListWithFlags(folder storage.Folder, pretty bool, json bool, detail bool)

TODO : unit tests

func HandleBackupMark added in v0.2.12

func HandleBackupMark(uploader *Uploader, backupName string, toPermanent bool)

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 HandleDeleteBefore(folder storage.Folder, args []string, confirmed bool,
	isFullBackup func(object storage.Object) bool,
	less func(object1, object2 storage.Object) bool)

func HandleDeleteRetain added in v0.2.8

func HandleDeleteRetain(folder storage.Folder, args []string, confirmed bool,
	isFullBackup func(object storage.Object) bool,
	less func(object1, object2 storage.Object) bool)

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

func HandleWALPrefetch(uploader *Uploader, walFileName string, location string)

TODO : unit tests HandleWALPrefetch is invoked by wal-fetch command to speed up database restoration

func HandleWALPush

func HandleWALPush(uploader *Uploader, walFilePath string)

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 IsAllowedSetting(setting string, AllowedSettings map[string]bool) (exists bool)

func IsDirectoryEmpty

func IsDirectoryEmpty(directoryPath string) (bool, error)

TODO : unit tests

func IsPgControlRequired added in v0.2.4

func IsPgControlRequired(backup *Backup, sentinelDto BackupSentinelDto) bool

func LoadExtensions added in v0.2.7

func LoadExtensions(path string) error

func LogFileShouldBeFetched added in v0.2.12

func LogFileShouldBeFetched(backupStartUploadTime time.Time, endTS *time.Time, object storage.Object) bool

func MarkBackup added in v0.2.12

func MarkBackup(uploader *Uploader, folder storage.Folder, backupName string, toPermanent bool)

MarkBackup marks a backup as permanent or impermanent

func NewDiskLimitReader

func NewDiskLimitReader(r io.Reader) io.Reader

NewDiskLimitReader returns a reader that is rate limited by disk limiter

func NewNetworkLimitReader

func NewNetworkLimitReader(r io.Reader) io.Reader

NewNetworkLimitReader returns a reader that is rate limited by network limiter

func PackFileTo

func PackFileTo(tarBall TarBall, fileInfoHeader *tar.Header, fileContent io.Reader) (fileSize int64, err error)

func ParseTS added in v0.2.14

func ParseTS(endTSEnvVar string) (endTS *time.Time, err error)

func ParseWALFilename

func ParseWALFilename(name string) (timelineID uint32, logSegNo uint64, err error)

ParseWALFilename extracts numeric parts from WAL file name

func ReadIncrementFileHeader

func ReadIncrementFileHeader(reader io.Reader) error

func ReadIncrementalFile

func ReadIncrementalFile(filePath string, fileSize int64, lsn uint64, deltaBitmap *roaring.Bitmap) (fileReader io.ReadCloser, size int64, err error)

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 RegisterExtensionCommands(rootCmd *cobra.Command)

func SelectRelFileBlocks

func SelectRelFileBlocks(bitmap *roaring.Bitmap, relFileId int) *roaring.Bitmap

func SetLastDecompressor added in v0.2.10

func SetLastDecompressor(decompressor compression.Decompressor) error

func ShouldPrefault

func ShouldPrefault(name string) (lsn uint64, shouldPrefault bool, timelineId uint32, err error)

func StartCommand added in v0.2.12

func StartCommand(command []string) (waitFunc func(), stdout io.ReadCloser)

func ToPartFilename

func ToPartFilename(deltaFilename string) string

func TryDownloadWALFile

func TryDownloadWALFile(folder storage.Folder, walPath string) (walFileReader io.ReadCloser, exists bool, err error)

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

func UploadSentinel(uploader *Uploader, sentinelDto interface{}, backupName string) error

TODO : unit tests

func UploadWALFile added in v0.2.7

func UploadWALFile(uploader *Uploader, walFilePath string, preventWalOverwrite bool) error

TODO : unit tests uploadWALFile from FS to the cloud

func WriteAsJson added in v0.2.12

func WriteAsJson(data interface{}, output io.Writer, pretty bool) error

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 GetBackupByName(backupName string, folder storage.Folder) (*Backup, error)

func NewBackup

func NewBackup(baseBackupFolder storage.Folder, name string) *Backup

func (*Backup) CheckExistence

func (backup *Backup) CheckExistence() (bool, error)

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

func (backup *Backup) FetchSentinelData() ([]byte, error)

TODO : unit tests

func (*Backup) GetFilesToUnwrap added in v0.2.10

func (backup *Backup) GetFilesToUnwrap(fileMask string) (map[string]bool, error)

func (*Backup) GetMetadataPath added in v0.2.10

func (backup *Backup) GetMetadataPath() string

func (*Backup) GetSentinel added in v0.2.10

func (backup *Backup) GetSentinel() (BackupSentinelDto, error)

func (*Backup) GetStopSentinelPath added in v0.2.7

func (backup *Backup) GetStopSentinelPath() string

func (*Backup) GetTarNames

func (backup *Backup) GetTarNames() ([]string, error)

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

func (*BgUploader) Stop

func (bgUploader *BgUploader) Stop()

Stop pipeline

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

type BlockLocationWriter struct {
	Underlying io.Writer
}

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 *Bundle) CheckSizeAndEnqueueBack(tarBall TarBall) error

func (*Bundle) Deque

func (bundle *Bundle) Deque() TarBall

func (*Bundle) DownloadDeltaMap

func (bundle *Bundle) DownloadDeltaMap(folder storage.Folder, backupStartLSN uint64) error

func (*Bundle) EnqueueBack

func (bundle *Bundle) EnqueueBack(tarBall TarBall)

func (*Bundle) FinishQueue

func (bundle *Bundle) FinishQueue() error

func (*Bundle) GetFileRelPath

func (bundle *Bundle) GetFileRelPath(fileAbsPath string) string

func (*Bundle) GetFiles

func (bundle *Bundle) GetFiles() *sync.Map

func (*Bundle) GetIncrementBaseFiles

func (bundle *Bundle) GetIncrementBaseFiles() BackupFileList

GetIncrementBaseFiles returns list of Files from previous backup

func (*Bundle) GetIncrementBaseLsn

func (bundle *Bundle) GetIncrementBaseLsn() *uint64

GetIncrementBaseLsn returns LSN of previous backup

func (*Bundle) HandleWalkedFSObject

func (bundle *Bundle) HandleWalkedFSObject(path string, info os.FileInfo, err error) error

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

func (bundle *Bundle) NewTarBall(dedicatedUploader bool)

NewTarBall starts writing new tarball

func (*Bundle) PrefaultWalkedFSObject

func (bundle *Bundle) PrefaultWalkedFSObject(path string, info os.FileInfo, err error) error

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 *Bundle) StartQueue() error

func (*Bundle) UploadLabelFiles

func (bundle *Bundle) UploadLabelFiles(conn *pgx.Conn) (uint64, error)

TODO : unit tests UploadLabelFiles creates the `backup_label` and `tablespace_map` files by stopping the backup and uploads them to S3.

func (*Bundle) UploadPgControl

func (bundle *Bundle) UploadPgControl(compressorFileExtension string) error

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

type Cleaner interface {
	GetFiles(directory string) ([]string, error)
	Remove(file string)
}

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
}

func LoadDeltaFile

func LoadDeltaFile(reader io.Reader) (*DeltaFile, error)

func NewDeltaFile

func NewDeltaFile(walParser *walparser.WalParser) (*DeltaFile, error)

func (*DeltaFile) Save

func (deltaFile *DeltaFile) Save(writer io.Writer) error

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

type DeltaNo added in v0.2.12

type DeltaNo uint64

func NewDeltaNoFromFilename added in v0.2.12

func NewDeltaNoFromFilename(filename string) (DeltaNo, error)

func NewDeltaNoFromFilenameNoError added in v0.2.12

func NewDeltaNoFromFilenameNoError(filename string) DeltaNo

func NewDeltaNoFromLsn added in v0.2.12

func NewDeltaNoFromLsn(lsn uint64) DeltaNo

func NewDeltaNoFromWalSegmentNo added in v0.2.12

func NewDeltaNoFromWalSegmentNo(walSegmentNo WalSegmentNo) DeltaNo

func (DeltaNo) Add added in v0.2.12

func (deltaNo DeltaNo) Add(n uint64) DeltaNo

func (DeltaNo) FirstLsn added in v0.2.12

func (deltaNo DeltaNo) FirstLsn() uint64

func (DeltaNo) FirstWalSegmentNo added in v0.2.12

func (deltaNo DeltaNo) FirstWalSegmentNo() WalSegmentNo

func (DeltaNo) GetFilename added in v0.2.12

func (deltaNo DeltaNo) GetFilename(timeline uint32) string

func (DeltaNo) Next added in v0.2.12

func (deltaNo DeltaNo) Next() DeltaNo

func (DeltaNo) Previous added in v0.2.12

func (deltaNo DeltaNo) Previous() DeltaNo

func (DeltaNo) Sub added in v0.2.12

func (deltaNo DeltaNo) Sub(n uint64) DeltaNo

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.

func (EmptyWriteIgnorer) Write

func (e EmptyWriteIgnorer) Write(p []byte) (int, error)

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 Extension added in v0.2.7

type Extension interface {
	RegisterCommands(cmd *cobra.Command)
	GetAllowedConfigKeys() map[string]*string
}

type FileSystemCleaner

type FileSystemCleaner struct{}

FileSystemCleaner actually performs it's functions on file system

func (FileSystemCleaner) GetFiles

func (cleaner FileSystemCleaner) GetFiles(directory string) (files []string, err error)

TODO : unit tests GetFiles of a directory

func (FileSystemCleaner) Remove

func (cleaner FileSystemCleaner) Remove(file string)

Remove file

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

type InvalidIncrementFileHeaderError

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

func NewInvalidIncrementFileHeaderError

func NewInvalidIncrementFileHeaderError() InvalidIncrementFileHeaderError

func (InvalidIncrementFileHeaderError) Error

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 NewLazyCache(load func(key interface{}) (value interface{}, err error)) *LazyCache

func (*LazyCache) Load

func (lazyCache *LazyCache) Load(key interface{}) (value interface{}, exists bool, err error)

func (*LazyCache) LoadExisting

func (lazyCache *LazyCache) LoadExisting(key interface{}) (value interface{}, exists bool)

func (*LazyCache) Range

func (lazyCache *LazyCache) Range(reduce func(key, value interface{}) bool)

Range calls reduce sequentially for each key and value present in the cache. If reduce returns false, range stops the iteration.

func (*LazyCache) Store

func (lazyCache *LazyCache) Store(key, value interface{})

type LogFetchHandlers added in v0.2.12

type LogFetchHandlers interface {
	GetLogFilePath(pathToLog string) (string, error)
	ShouldBeAborted(pathToLog string) (bool, error)
	DownloadLogTo(logFolder storage.Folder, logName string, dstLogFilePath string) error
	HandleAbortFetch(string) error
}

type LogFetchSettings added in v0.2.12

type LogFetchSettings interface {
	GetEndTS() (*time.Time, error)
	GetDestFolderPath() (string, error)
	GetLogFolderPath() string
}

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 NamedReader interface {
	io.Reader
	Name() string
}

type NamedReaderImpl

type NamedReaderImpl struct {
	io.Reader
	// contains filtered or unexported fields
}

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

type NopASM added in v0.2.14

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

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 GetDeltaMap(folder storage.Folder, timeline uint32, firstUsedLSN, firstNotUsedLSN uint64) (PagedFileDeltaMap, error)

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 (deltaMap *PagedFileDeltaMap) GetLocationsFromDeltas(folder storage.Folder, timeline uint32, first, last DeltaNo) error

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 Saver

type Saver interface {
	Save(writer io.Writer) error
}

type Sentinel

type Sentinel struct {
	Info os.FileInfo
	// contains filtered or unexported fields
}

Sentinel is used to signal completion of a walked directory.

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

type StorageReaderMaker struct {
	Folder       storage.Folder
	RelativePath string
}

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 TablespaceLocation struct {
	Location string `json:"loc"`
	Symlink  string `json:"link"`
}

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 (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

type TarBallMaker interface {
	Make(dedicatedUploader bool) TarBall
}

TarBallMaker is used to allow for flexible creation of different TarBalls.

func NewNopTarBallMaker

func NewNopTarBallMaker() TarBallMaker

type TarInterpreter

type TarInterpreter interface {
	Interpret(reader io.Reader, header *tar.Header) error
}

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

type UnknownIncrementFileHeaderError

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

func NewUnknownIncrementFileHeaderError

func NewUnknownIncrementFileHeaderError() UnknownIncrementFileHeaderError

func (UnknownIncrementFileHeaderError) Error

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

type UploadObject added in v0.2.10

type UploadObject struct {
	Path    string
	Content io.Reader
}

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 ConfigureMockUploaderWithoutCompressMethod() (uploader *Uploader, err error)

func ConfigureUploader added in v0.2.8

func ConfigureUploader() (uploader *Uploader, err error)

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) Clone

func (uploader *Uploader) Clone() *Uploader

Clone creates similar Uploader with new WaitGroup

func (*Uploader) PushStream added in v0.2.10

func (uploader *Uploader) PushStream(stream io.Reader) (string, error)

TODO : unit tests PushStream compresses a stream and push it

func (*Uploader) PushStreamToDestination added in v0.2.10

func (uploader *Uploader) PushStreamToDestination(stream io.Reader, dstPath string) error

TODO : unit tests PushStreamToDestination compresses a stream and push it to specifyed destination

func (*Uploader) Upload added in v0.2.7

func (uploader *Uploader) Upload(path string, content io.Reader) error

TODO : unit tests

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 LoadWalPart

func LoadWalPart(reader io.Reader) (*WalPart, error)

func NewWalPart

func NewWalPart(dataType WalPartDataType, id uint8, data []byte) *WalPart

func (*WalPart) Save

func (part *WalPart) Save(writer io.Writer) error

type WalPartDataType

type WalPartDataType uint8
const (
	PreviousWalHeadType WalPartDataType = 0
	WalTailType         WalPartDataType = 1
	WalHeadType         WalPartDataType = 2
)

type WalPartFile

type WalPartFile struct {
	WalTails        [][]byte
	PreviousWalHead []byte
	WalHeads        [][]byte
}

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

func (*WalPartFile) Save

func (partFile *WalPartFile) Save(writer io.Writer) error

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
}

func (*WithSizeReader) Read added in v0.2.13

func (reader *WithSizeReader) Read(p []byte) (n int, err error)

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

Directories

Path Synopsis
lz4
databases

Jump to

Keyboard shortcuts

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