This commit is contained in:
bel
2025-06-19 16:49:06 -06:00
parent e4451923e9
commit 5a0f567da3
3 changed files with 28 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package storage
import (
"errors"
"gitea.inhome.blapointe.com/local/rproxy3/storage/packable"
)
@@ -10,5 +11,6 @@ var ErrNotFound = errors.New("not found")
type DB interface {
Get(string, string, packable.Packable) error
Set(string, string, packable.Packable) error
Keys(string) []string
Close() error
}

View File

@@ -2,6 +2,7 @@ package storage
import (
"fmt"
"gitea.inhome.blapointe.com/local/rproxy3/storage/packable"
)
@@ -40,6 +41,15 @@ func (m Map) Close() error {
return nil
}
func (m Map) Keys(ns string) []string {
m2, _ := m[ns]
result := make([]string, 0, len(m2))
for k := range m2 {
result = append(result, k)
}
return result
}
func (m Map) Get(ns, key string, value packable.Packable) error {
if _, ok := m[ns]; !ok {
m[ns] = make(map[string][]byte)