-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multi-database support to EchoVault #83
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…and standalone persistence initialisation until their implementations support databases as well.
… done. Updated function signatures in handler params for built-in commands and for modules. Disabled snapshots and snapshot restoration until a multi-database implementation is done.
…oes not exist when trying to set a value.
…termine which connection info to use into the handleCommand function.
Load modules build from Dockerfile.dev into instances from docker-compose.yml. Fixed user loading from config file in ACL module.
…d echo command to the list of commands that are skipped on ACL authorization.
…unction. Implemented SELECT command to allow TCP connections to select a different database.
…comments to SwapDBs and Flush methods.
…horization in acl module. Added tests for HELLO and SELECT client-server commands
Added multi-database support for preamble snapshots and restoration in preamble engine. Added multi-database support for aof engine. Removed buffered channel from log and aof engines. Command logging is now synchronous. Added multi-database support for the raft layer's data replication.
Added test cases for incorrect commands length for INCR command. Fixed error checking on INCR commands test. RESP errors will be contained in the response object of the ReadValue method. The error object only contains an error when ReadValue failes.
Rebased with main branch.
… done. Updated function signatures in handler params for built-in commands and for modules. Disabled snapshots and snapshot restoration until a multi-database implementation is done.
Added multi-database support for preamble snapshots and restoration in preamble engine. Added multi-database support for aof engine. Removed buffered channel from log and aof engines. Command logging is now synchronous. Added multi-database support for the raft layer's data replication.
Closed
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #83 +/- ##
==========================================
- Coverage 80.39% 79.88% -0.51%
==========================================
Files 48 50 +2
Lines 8304 8692 +388
==========================================
+ Hits 6676 6944 +268
- Misses 1144 1246 +102
- Partials 484 502 +18 ☔ View full report in Codecov by Sentry. |
…ng snapshot on startup. Implemented tests for HELLO command in echovault package. Implemented tests for GetServerInfo in echovault package.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds key name spacing using logical database to EchoVault. These name spaces are called
databases
and can be selected using indexes.Features
Client-Server Commands
HELLO
HELLO [protover [AUTH username password] [SETNAME clientname]]
The hello commands returns information about the client. The
AUTH
options allow the client to authenticate itself. TheSETNAME
sets the alias for the current connection.Example response with protocol 2:
Example response with protocol 3:
SELECT
SELECT index
Change the logical database that the current connection is operating from.
SWAPDB
SWAPDB index1 index2
This command swaps two databases,
so that immediately all the clients connected to a given database will see the data of the other database,
and the other way around.
FLUSHALL
FLUSHALL
Delete all the keys in all the existing databases. This command is always synchronous.
FLUSHDB
FLUSHDB
Delete all the keys in the currently selected database. This command is always synchronous.
Embedded API
SetProtocol
echovault.SetProtocol(protocol int) error
This methods sets the protocol that is expected by responses to embedded API calls. This is relevant for the
ExecuteCommand
methods which returns raw RESP to the caller.SelectDB
echovault.SelectDB(database int) error
This method sets the database that the embedded client is operating from.
SwapDBs
echovault.SwapDBs(database1, database2 int)
SwapDBs swaps every TCP client connection from database1 over to database2. It also swaps every TCP client connection from database2 over to database1. This only affects TCP connections, it does not swap the logical database currently being used by the embedded API.
Flush
echovault.Flush(database int)
Flush flushes all the data from the database at the specified index. When -1 is passed, all the logical databases are cleared.