-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: tellydb is now completely in-memory database
note: only supports for primitive types for now feat(database): add DIRECT I/O for database file perf: reduce system calls feat(database): renew password saving to database file feat(database): change password deriving algorithm to HKDF on SHA384 perf(database): change password structure fix(database): missing configuration freeing on checking lock file docs(file): change authorization file specification perf(commands): replace where_password with get_password in AUTH command feat(commands): add RENAME and DEL commands refactor(utils): add length argument to hash method refactor(database): change get_data argument to string_t feat(commands): add DELETE command feat(commands): add deleting empty data to HDEL, RPOP and LPOP commands perf(database): remove null terminator from data keys
- Loading branch information
Showing
43 changed files
with
598 additions
and
848 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "../../../headers/server.h" | ||
#include "../../../headers/database.h" | ||
#include "../../../headers/commands.h" | ||
|
||
#include <stdio.h> | ||
#include <stdint.h> | ||
|
||
static void run(struct Client *client, commanddata_t *command, struct Password *password) { | ||
if (command->arg_count == 0) { | ||
if (client) WRONG_ARGUMENT_ERROR(client, "DEL", 3); | ||
return; | ||
} | ||
|
||
if (password->permissions & P_WRITE) { | ||
uint32_t deleted = 0; | ||
|
||
for (uint32_t i = 0; i < command->arg_count; ++i) { | ||
deleted += delete_data(command->args[i]); | ||
} | ||
|
||
if (client) { | ||
char res[13]; | ||
const size_t res_len = sprintf(res, ":%d\r\n", deleted); | ||
|
||
_write(client, res, res_len); | ||
} | ||
} else if (client) { | ||
_write(client, "-Not allowed to use this command, need P_WRITE\r\n", 48); | ||
} | ||
} | ||
|
||
const struct Command cmd_del = { | ||
.name = "DEL", | ||
.summary = "Deletes the specified keys.", | ||
.since = "0.1.7", | ||
.complexity = "O(N) where N is key count", | ||
.subcommands = NULL, | ||
.subcommand_count = 0, | ||
.run = run | ||
}; |
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
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
Oops, something went wrong.