Added godoc comments for api_admin.go functions

This commit is contained in:
Kelvin Mwinuka
2024-04-03 07:16:37 +08:00
parent 501879d920
commit dca58e0ba0
2 changed files with 652 additions and 632 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -16,12 +16,26 @@ package echovault
import "github.com/echovault/echovault/internal"
// CommandListOptions modifies the result from the COMMAND_LIST command.
//
// ACLCAT filters the results by the provided category. Has the highest priority.
//
// PATTERN filters the result that match the given glob pattern. Has the second-highest priority.
//
// MODULE filters the result by the provided module. Has the lowest priority.
type CommandListOptions struct {
ACLCAT string
PATTERN string
MODULE string
}
// COMMAND_LIST returns the list of commands currently loaded in the EchoVault instance.
//
// Parameters:
//
// `options` - CommandListOptions.
//
// Returns: a string slice of all the loaded commands. SubCommands are represented as "command|subcommand".
func (server *EchoVault) COMMAND_LIST(options CommandListOptions) ([]string, error) {
cmd := []string{"COMMAND", "LIST"}
@@ -42,6 +56,9 @@ func (server *EchoVault) COMMAND_LIST(options CommandListOptions) ([]string, err
return internal.ParseStringArrayResponse(b)
}
// COMMAND_COUNT returns the number of commands currently loaded in the EchoVault instance.
//
// Returns: integer representing the count of all available commands.
func (server *EchoVault) COMMAND_COUNT() (int, error) {
b, err := server.handleCommand(server.context, internal.EncodeCommand([]string{"COMMAND", "COUNT"}), nil, false)
if err != nil {
@@ -50,6 +67,7 @@ func (server *EchoVault) COMMAND_COUNT() (int, error) {
return internal.ParseIntegerResponse(b)
}
// SAVE triggers a new snapshot.
func (server *EchoVault) SAVE() (string, error) {
b, err := server.handleCommand(server.context, internal.EncodeCommand([]string{"SAVE"}), nil, false)
if err != nil {
@@ -58,6 +76,7 @@ func (server *EchoVault) SAVE() (string, error) {
return internal.ParseStringResponse(b)
}
// LASTSAVE returns the unix epoch milliseconds timestamp of the last save.
func (server *EchoVault) LASTSAVE() (int, error) {
b, err := server.handleCommand(server.context, internal.EncodeCommand([]string{"LASTSAVE"}), nil, false)
if err != nil {
@@ -66,6 +85,7 @@ func (server *EchoVault) LASTSAVE() (int, error) {
return internal.ParseIntegerResponse(b)
}
// REWRITEAOF triggers a compaction of the AOF file.
func (server *EchoVault) REWRITEAOF() (string, error) {
b, err := server.handleCommand(server.context, internal.EncodeCommand([]string{"REWRITEAOF"}), nil, false)
if err != nil {