toc

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SectionNone     int32 = iota + 1
	SectionPreData        /* stuff to be processed before data */
	SectionData           /* table data, large objects, LO comments */
	SectionPostData       /* stuff to be processed after data */
)
View Source
const (
	ArchUnknown   byte = 0
	ArchCustom    byte = 1
	ArchTar       byte = 3
	ArchNull      byte = 4
	ArchDirectory byte = 5
)
View Source
const (
	PgCompressionNone int32 = iota
	PgCompressionGzip
	PgCompressionLz4
	PgCompressionZSTD
)
View Source
const InvalidOid = 0
View Source
const MaxVersion = "1.16"

Variables

View Source
var (
	TableDataDesc    = "TABLE DATA"
	LargeObjectsDesc = "BLOB"
	BlobsDesc        = "BLOBS"
	SequenceSetDesc  = "SEQUENCE SET"
	CommentDesc      = "COMMENT"
	AclDesc          = "ACL"
)
View Source
var (
	BackupVersions = map[string]int{
		"1.0":  MakeArchiveVersion(1, 0, 0),
		"1.2":  MakeArchiveVersion(1, 2, 0),
		"1.3":  MakeArchiveVersion(1, 3, 0),
		"1.4":  MakeArchiveVersion(1, 4, 0),
		"1.5":  MakeArchiveVersion(1, 5, 0),
		"1.6":  MakeArchiveVersion(1, 6, 0),
		"1.7":  MakeArchiveVersion(1, 7, 0),
		"1.8":  MakeArchiveVersion(1, 8, 0),
		"1.9":  MakeArchiveVersion(1, 9, 0),
		"1.10": MakeArchiveVersion(1, 10, 0),
		"1.11": MakeArchiveVersion(1, 11, 0),
		"1.12": MakeArchiveVersion(1, 12, 0),
		"1.13": MakeArchiveVersion(1, 13, 0),
		"1.14": MakeArchiveVersion(1, 14, 0),
		"1.15": MakeArchiveVersion(1, 15, 0),
		"1.16": MakeArchiveVersion(1, 16, 0),
	}

	BackupFormats = map[byte]string{
		ArchUnknown:   "unknown",
		ArchCustom:    "custom",
		ArchTar:       "tar",
		ArchNull:      "null",
		ArchDirectory: "directory",
	}
)
View Source
var SectionMap = map[int32]string{
	SectionNone:     "None",
	SectionPreData:  "PreData",
	SectionData:     "Data",
	SectionPostData: "PostData",
}

Functions

func MakeArchiveVersion

func MakeArchiveVersion(major, minor, rev byte) int

func NewObj added in v0.1.8

func NewObj[T string | Toc | Header | Entry](v T) *T

Types

type CatalogId

type CatalogId struct {
	TableOid Oid
	Oid      Oid
}

type CompressionSpecification

type CompressionSpecification struct {
	Algorithm int32
	Options   uint32
	Level     int32
	Workers   int32
}

type Crtm

type Crtm struct {
	TmSec   int32
	TmMin   int32
	TmHour  int32
	TmMday  int32
	TmMon   int32
	TmYear  int32
	TmIsDst int32
}

func (*Crtm) Time

func (c *Crtm) Time() time.Time

type DumpIdSequence

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

func NewDumpSequence

func NewDumpSequence(initVal int32) *DumpIdSequence

func (*DumpIdSequence) Next

func (dis *DumpIdSequence) Next() int32

type Entry

type Entry struct {
	CatalogId CatalogId
	DumpId    int32
	Section   int32
	HadDumper int32 /* Archiver was passed a dumper routine (used
	 * in restore) */
	Tag        *string /* index Tag */
	Namespace  *string /* null or empty string if not in a schema */
	Tablespace *string /* null if not in a Tablespace; empty string
	 * means use database default */
	Tableam      *string /* table access method, only for TABLE tags */
	Owner        *string
	Desc         *string
	Defn         *string
	DropStmt     *string
	CopyStmt     *string
	Dependencies []int32 /* dumpIds of objects this one depends on */
	NDeps        int32   /* number of Dependencies */
	FileName     *string
	Relkind      byte /* relation kind, only for TABLE tags */

	DataDumper int32 /* Routine to dump data for object */

	/* working state while dumping/restoring */
	DataLength uint32 /* item's data size; 0 if none or unknown */

}

func (*Entry) Copy added in v0.1.8

func (e *Entry) Copy() *Entry
type Header struct {
	VersionMajor byte
	VersionMinor byte
	VersionRev   byte
	Version      int /* Version of file */
	IntSize      uint32
	// TODO: How affects that offset size for reading the file
	OffSize              uint32 /* Size of a file offset in the archive - Added V1.7 */
	Format               byte
	CompressionSpec      CompressionSpecification
	CrtmDateTime         Crtm
	ArchDbName           *string
	ArchiveRemoteVersion *string /* When reading an archive, the version of the dumped DB */
	ArchiveDumpVersion   *string /* When reading an archive, the version of the dumper */
	TocCount             int32
	MaxDumpId            int32
}

func (*Header) Copy added in v0.1.8

func (h *Header) Copy() *Header

type Oid

type Oid int32

type Reader

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

func NewReader

func NewReader(r io.Reader) *Reader

func (*Reader) Read

func (r *Reader) Read() (*Toc, error)

type Toc

type Toc struct {
	Header  *Header
	Entries []*Entry
}

func (*Toc) Copy added in v0.1.8

func (t *Toc) Copy() *Toc

type Writer

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

func NewWriter

func NewWriter(w io.Writer) *Writer

func (*Writer) Write

func (w *Writer) Write(toc *Toc) error

Jump to

Keyboard shortcuts

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