Skip to content

Commit

Permalink
Removed Plugin struct and it's receiver functions in all the modules
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinmwinuka committed Feb 14, 2024
1 parent 7c06869 commit 6cb38ee
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 204 deletions.
19 changes: 0 additions & 19 deletions src/modules/acl/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@ import (
"strings"
)

type Plugin struct {
name string
commands []utils.Command
description string
acl *ACL
}

func (p Plugin) Name() string {
return p.name
}

func (p Plugin) Commands() []utils.Command {
return p.commands
}

func (p Plugin) Description() string {
return p.description
}

func handleAuth(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {
if len(cmd) < 2 || len(cmd) > 3 {
return nil, errors.New(utils.WRONG_ARGS_RESPONSE)
Expand Down
18 changes: 0 additions & 18 deletions src/modules/admin/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@ import (
"net"
)

type Plugin struct {
name string
commands []utils.Command
description string
}

func (p Plugin) Name() string {
return p.name
}

func (p Plugin) Commands() []utils.Command {
return p.commands
}

func (p Plugin) Description() string {
return p.description
}

func Commands() []utils.Command {
return []utils.Command{
{
Expand Down
18 changes: 0 additions & 18 deletions src/modules/etc/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,6 @@ type KeyObject struct {
locked bool
}

type Plugin struct {
name string
description string
commands []utils.Command
}

func (p Plugin) Name() string {
return p.name
}

func (p Plugin) Commands() []utils.Command {
return p.commands
}

func (p Plugin) Description() string {
return p.description
}

func handleSet(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
Expand Down
19 changes: 0 additions & 19 deletions src/modules/get/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,6 @@ import (
"net"
)

type Plugin struct {
name string
commands []utils.Command
categories []string
description string
}

func (p Plugin) Name() string {
return p.name
}

func (p Plugin) Commands() []utils.Command {
return p.commands
}

func (p Plugin) Description() string {
return p.description
}

func handleGet(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {
if len(cmd) != 2 {
return nil, errors.New(utils.WRONG_ARGS_RESPONSE)
Expand Down
18 changes: 0 additions & 18 deletions src/modules/hash/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,6 @@ import (
"strings"
)

type Plugin struct {
name string
commands []utils.Command
description string
}

func (p Plugin) Name() string {
return p.name
}

func (p Plugin) Commands() []utils.Command {
return p.commands
}

func (p Plugin) Description() string {
return p.description
}

func handleHSET(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {
if len(cmd) < 4 {
return nil, errors.New(utils.WRONG_ARGS_RESPONSE)
Expand Down
19 changes: 0 additions & 19 deletions src/modules/list/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,6 @@ import (
"strings"
)

type Plugin struct {
name string
commands []utils.Command
categories []string
description string
}

func (p Plugin) Name() string {
return p.name
}

func (p Plugin) Commands() []utils.Command {
return p.commands
}

func (p Plugin) Description() string {
return p.description
}

func handleLLen(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {
if len(cmd) != 2 {
return nil, errors.New(utils.WRONG_ARGS_RESPONSE)
Expand Down
18 changes: 0 additions & 18 deletions src/modules/ping/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@ import (
"net"
)

type Plugin struct {
name string
commands []utils.Command
description string
}

func (p Plugin) Name() string {
return p.name
}

func (p Plugin) Commands() []utils.Command {
return p.commands
}

func (p Plugin) Description() string {
return p.description
}

func handlePing(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {
switch len(cmd) {
default:
Expand Down
19 changes: 0 additions & 19 deletions src/modules/pubsub/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,6 @@ import (
"net"
)

type Plugin struct {
name string
commands []utils.Command
description string
pubSub *PubSub
}

func (p Plugin) Name() string {
return p.name
}

func (p Plugin) Commands() []utils.Command {
return p.commands
}

func (p Plugin) Description() string {
return p.description
}

func handleSubscribe(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {
pubsub, ok := server.GetPubSub().(*PubSub)
if !ok {
Expand Down
19 changes: 0 additions & 19 deletions src/modules/set/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,6 @@ import (
"strings"
)

type Plugin struct {
name string
commands []utils.Command
categories []string
description string
}

func (p Plugin) Name() string {
return p.name
}

func (p Plugin) Commands() []utils.Command {
return p.commands
}

func (p Plugin) Description() string {
return p.description
}

func handleSADD(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {
if len(cmd) < 3 {
return nil, errors.New(utils.WRONG_ARGS_RESPONSE)
Expand Down
19 changes: 0 additions & 19 deletions src/modules/sorted_set/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,6 @@ import (
"strings"
)

type Plugin struct {
name string
commands []utils.Command
categories []string
description string
}

func (p Plugin) Name() string {
return p.name
}

func (p Plugin) Commands() []utils.Command {
return p.commands
}

func (p Plugin) Description() string {
return p.description
}

func handleZADD(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {
if len(cmd) < 4 {
return nil, errors.New(utils.WRONG_ARGS_RESPONSE)
Expand Down
18 changes: 0 additions & 18 deletions src/modules/string/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@ import (
"net"
)

type Plugin struct {
name string
commands []utils.Command
description string
}

func (p Plugin) Name() string {
return p.name
}

func (p Plugin) Commands() []utils.Command {
return p.commands
}

func (p Plugin) Description() string {
return p.description
}

func handleSetRange(ctx context.Context, cmd []string, server utils.Server, conn *net.Conn) ([]byte, error) {
if len(cmd[1:]) != 3 {
return nil, errors.New(utils.WRONG_ARGS_RESPONSE)
Expand Down

0 comments on commit 6cb38ee

Please sign in to comment.