setup.go
setup.go - Overview
This file provides utility functions for setting up and managing test servers and connections in the ironhawk
package.
Detailed Documentation
getLocalConnection
Purpose: Creates a new DiceDB client connected to the local server.
Returns:
*dicedb.Client
: A pointer to the newly created DiceDB client.
ClosePublisherSubscribers
Purpose: Closes the publisher and subscriber connections.
Parameters:
publisher
(net.Conn
): The publisher connection to close.subscribers
([]net.Conn
): A slice of subscriber connections to close.
Returns:
error
: An error if any connection fails to close, otherwisenil
.
getLocalSdk
Purpose: Creates a new DiceDB client (SDK) connected to the local server.
Returns:
*dicedb.Client
: A pointer to the newly created DiceDB client.
RunTestServer
Purpose: Runs a test server with a shard manager, IO thread manager, and watch manager.
Parameters:
wg
(*sync.WaitGroup
): A pointer to a WaitGroup to synchronize the server's start and stop.