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 ¶
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 ¶
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.