Updated keyspace methods' signatures and made them all private. Ditched lock-per-key for a store-wide rwmutex. Updated HandlerFuncParams to match new keyspace method signatures.

This commit is contained in:
Kelvin Clement Mwinuka
2024-05-22 22:44:59 +08:00
parent f894a531b0
commit 43361cdd42
6 changed files with 570 additions and 697 deletions

View File

@@ -59,18 +59,12 @@ type HandlerFuncParams struct {
Context context.Context
Command []string
Connection *net.Conn
KeyLock func(ctx context.Context, key string) (bool, error)
KeyUnlock func(ctx context.Context, key string)
KeyRLock func(ctx context.Context, key string) (bool, error)
KeyRUnlock func(ctx context.Context, key string)
KeyExists func(ctx context.Context, key string) bool
CreateKeyAndLock func(ctx context.Context, key string) (bool, error)
GetValue func(ctx context.Context, key string) interface{}
SetValue func(ctx context.Context, key string, value interface{}) error
GetExpiry func(ctx context.Context, key string) time.Time
KeysExist func(keys []string) map[string]bool
GetExpiry func(key string) time.Time
DeleteKey func(key string) error
GetValues func(ctx context.Context, keys []string) map[string]interface{}
SetValues func(ctx context.Context, entries map[string]interface{}) error
SetExpiry func(ctx context.Context, key string, expire time.Time, touch bool)
RemoveExpiry func(ctx context.Context, key string)
DeleteKey func(ctx context.Context, key string) error
GetClock func() clock.Clock
GetAllCommands func() []Command
GetACL func() interface{}