datatransfers

package
v0.0.0-...-d7e708e Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: PostgreSQL Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConnStrings

func GetConnStrings(s *config.ShardConnect) []string

GetConnStrings generates connection strings based on the ShardConnect fields.

Parameters: - None.

Returns: - []string: a slice of strings containing connection strings.

func GetMasterConnection

func GetMasterConnection(ctx context.Context, s *config.ShardConnect) (*pgx.Conn, error)

GetMasterConnection gets a connection to the master host in a shard

Parameters:

  • ctx: context for connections

Returns:

  • *pgx.Conn: the connection to master host
  • error: error if any occured

TODO: unit tests

func LoadConfig

func LoadConfig(path string) error

LoadConfig loads the configuration from the specified path or the localConfigDir directory.

Parameters: - path (string): the path to the configuration file.

Returns: - error: an error if the configuration cannot be loaded.

func MoveKeys

func MoveKeys(ctx context.Context, fromId, toId string, krg *kr.KeyRange, ds *distributions.Distribution, db qdb.XQDB, cr coordinator.Coordinator) error

MoveKeys performs physical key-range move from one datashard to another.

It is assumed that the passed key range is already locked on every online spqr-router. The function performs the following steps:

  • Create a postgres_fdw on the receiving shard.
  • Copy data from the sending shard to the receiving shard via fdw.
  • Delete data from the sending shard.

Parameters:

  • ctx (context.Context): The context for the function.
  • fromId (string): the ID of the sending shard.
  • toId (string): the ID of the receiving shard.
  • krg (*kr.KeyRange): the KeyRange object representing the key range being moved.
  • ds (*distributions.Distribution): the Distributions object representing the distribution of data.
  • db (qdb.XQDB): the XQDB object for interacting with the database.
  • cr (coordinator.Coordinator): the Coordinator object for coordinating the move.

Returns:

  • error: an error if the move fails.

Types

type MoveTableRes

type MoveTableRes struct {
	TableSchema string `db:"table_schema"`
	TableName   string `db:"table_name"`
}

type ProxyW

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

func (*ProxyW) Write

func (p *ProxyW) Write(bt []byte) (int, error)

Write writes the given byte slice to the underlying io.WriteCloser.

Parameters: - bt ([]byte): a byte slice to be written.

Returns: - int: the number of bytes written. - error: an error, if any, that occurred during the

type Tx

type Tx interface {
	pgx.Tx
}

Jump to

Keyboard shortcuts

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