message

package
v0.0.0-...-0d0b246 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2019 License: MIT Imports: 5 Imported by: 10

Documentation

Index

Constants

View Source
const (
	ReplicaIdentityDefault ReplicaIdentity = 'd'
	ReplicaIdentityNothing                 = 'n'
	ReplicaIdentityIndex                   = 'i'
	ReplicaIdentityFull                    = 'f'

	TupleNull      TupleKind = 'n' // Identifies the data as NULL value.
	TupleUnchanged           = 'u' // Identifies unchanged TOASTed value (the actual value is not sent).
	TupleText                = 't' // Identifies the data as text formatted value.

	MsgInsert MType = iota
	MsgUpdate
	MsgDelete
	MsgBegin
	MsgCommit
	MsgRelation
	MsgType
	MsgOrigin
	MsgTruncate
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Begin

type Begin struct {
	RawMessage
	FinalLSN  dbutils.LSN // LSN of the record that lead to this xact to be committed
	Timestamp time.Time   // Commit timestamp of the transaction
	XID       int32       // Xid of the transaction.
}

func (Begin) MsgType

func (Begin) MsgType() MType

func (Begin) String

func (m Begin) String() string

type Column

type Column struct {
	IsKey   bool        `yaml:"IsKey"` // column as part of the key.
	Name    string      `yaml:"Name"`  // Name of the column.
	TypeOID dbutils.OID `yaml:"OID"`   // OID of the column's data type.
	Mode    int32       `yaml:"Mode"`  // OID modifier of the column (atttypmod).
}

type Commit

type Commit struct {
	RawMessage
	Flags          uint8       // Flags; currently unused (must be 0)
	LSN            dbutils.LSN // The LastLSN of the commit.
	TransactionLSN dbutils.LSN // LSN pointing to the end of the commit record + 1
	Timestamp      time.Time   // Commit timestamp of the transaction
}

func (Commit) MsgType

func (Commit) MsgType() MType

func (Commit) String

func (m Commit) String() string

type Delete

type Delete struct {
	RawMessage
	RelationOID dbutils.OID // OID of the relation corresponding to the OID in the relation message.

	Ident      []TupleData // Key or old row values
	IdentIsKey bool        // Whether Ident is key
}

func (Delete) MsgType

func (Delete) MsgType() MType

func (Delete) SQL

func (del Delete) SQL(rel Relation) string

func (Delete) String

func (m Delete) String() string

type DumpInfo

type DumpInfo struct {
	StartLSN       dbutils.LSN   `yaml:"StartLSN"`
	CreateDate     time.Time     `yaml:"CreateDate"`
	Relation       Relation      `yaml:"Relation"`
	BackupDuration time.Duration `yaml:"BackupDuration"`
}

type Insert

type Insert struct {
	RawMessage
	RelationOID dbutils.OID // OID of the relation corresponding to the OID in the relation message.

	NewRow []TupleData
}

func (Insert) MsgType

func (Insert) MsgType() MType

func (Insert) SQL

func (ins Insert) SQL(rel Relation) string

func (Insert) String

func (m Insert) String() string

type MType

type MType int

func (MType) String

func (t MType) String() string

type Message

type Message interface {
	fmt.Stringer

	MsgType() MType
	RawData() []byte
}

type NamespacedName

type NamespacedName struct {
	Namespace string `yaml:"Namespace"`
	Name      string `yaml:"Name"`
}

func (NamespacedName) Sanitize

func (n NamespacedName) Sanitize() string

func (NamespacedName) String

func (n NamespacedName) String() string

type Origin

type Origin struct {
	RawMessage
	LSN  dbutils.LSN // The last LSN of the commit on the origin server.
	Name string
}

func (Origin) MsgType

func (Origin) MsgType() MType

func (Origin) String

func (m Origin) String() string

type RawMessage

type RawMessage struct {
	Message
	Data []byte
}

func (RawMessage) RawData

func (m RawMessage) RawData() []byte

type Relation

type Relation struct {
	RawMessage
	NamespacedName `yaml:"NamespacedName"`

	OID             dbutils.OID     `yaml:"OID"`             // OID of the relation.
	ReplicaIdentity ReplicaIdentity `yaml:"ReplicaIdentity"` // Replica identity
	Columns         []Column        `yaml:"Columns"`         // Columns
}

func (*Relation) Equals

func (rel *Relation) Equals(rel2 *Relation) bool

Equals checks if rel2 is the same as rel. except for Raw field

func (*Relation) FetchByName

func (rel *Relation) FetchByName(conn queryRunner, tableName NamespacedName) error

FetchByName fetches relation info from the database by name

func (*Relation) FetchByOID

func (rel *Relation) FetchByOID(conn queryRunner, oid dbutils.OID) error

FetchByOID fetches relation info from the database by oid

func (Relation) MsgType

func (Relation) MsgType() MType

func (Relation) SQL

func (rel Relation) SQL(oldRel Relation) string

func (Relation) String

func (m Relation) String() string

func (Relation) Structure

func (rel Relation) Structure() string

type ReplicaIdentity

type ReplicaIdentity uint8

func (ReplicaIdentity) MarshalYAML

func (r ReplicaIdentity) MarshalYAML() (interface{}, error)

func (ReplicaIdentity) String

func (r ReplicaIdentity) String() string

func (*ReplicaIdentity) UnmarshalYAML

func (r *ReplicaIdentity) UnmarshalYAML(unmarshal func(interface{}) error) error

type Truncate

type Truncate struct {
	RawMessage
	Cascade         bool
	RestartIdentity bool
	RelationOIDs    []dbutils.OID
}

func (Truncate) MsgType

func (Truncate) MsgType() MType

func (Truncate) SQL

func (tr Truncate) SQL() string

func (Truncate) String

func (m Truncate) String() string

type TupleData

type TupleData struct {
	Kind  TupleKind
	Value []byte
}

func (TupleData) IsNull

func (t TupleData) IsNull() bool

func (TupleData) IsText

func (t TupleData) IsText() bool

func (TupleData) String

func (t TupleData) String() string

type TupleKind

type TupleKind uint8

func (TupleKind) String

func (t TupleKind) String() string

type Type

type Type struct {
	RawMessage
	NamespacedName

	OID dbutils.OID // OID of the data type
}

func (Type) MsgType

func (Type) MsgType() MType

func (Type) String

func (m Type) String() string

type Update

type Update struct {
	RawMessage
	RelationOID dbutils.OID // OID of the relation corresponding to the OID in the relation message.

	NewRow     []TupleData
	Ident      []TupleData // Key or old row values
	IdentIsKey bool        // Whether Ident is key
}

func (Update) MsgType

func (Update) MsgType() MType

func (Update) SQL

func (upd Update) SQL(rel Relation) string

func (Update) String

func (m Update) String() string

Jump to

Keyboard shortcuts

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