feat(lib/store): add bbolt store implementation

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso
2025-07-03 18:02:17 +00:00
parent ddb7b0e99e
commit 45f6fa2194
12 changed files with 353 additions and 6 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"github.com/TecharoHQ/anubis/lib/store"
_ "github.com/TecharoHQ/anubis/lib/store/all"
)
var (

View File

@@ -1,11 +1,12 @@
package config_test
import (
"encoding/json"
"errors"
"testing"
"github.com/TecharoHQ/anubis/lib/policy/config"
_ "github.com/TecharoHQ/anubis/lib/store/all"
"github.com/TecharoHQ/anubis/lib/store/bbolt"
)
func TestStoreValid(t *testing.T) {
@@ -25,6 +26,21 @@ func TestStoreValid(t *testing.T) {
Backend: "memory",
},
},
{
name: "bbolt backend",
input: config.Store{
Backend: "bbolt",
Parameters: json.RawMessage(`{"path": "/tmp/foo", "bucket": "bar"}`),
},
},
{
name: "bbolt backend no path",
input: config.Store{
Backend: "bbolt",
Parameters: json.RawMessage(`{"path": "", "bucket": "bar"}`),
},
err: bbolt.ErrMissingPath,
},
{
name: "unknown backend",
input: config.Store{