feat(index): db under .index/ dir
This commit is contained in:
parent
5f9eba77eb
commit
d9adf0e8df
3 changed files with 9 additions and 4 deletions
|
|
@ -2,8 +2,6 @@ package handlers
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log/slog"
|
||||
|
||||
"github.com/KristianJBorgwarth/dendrite.daemon/config"
|
||||
"github.com/KristianJBorgwarth/dendrite.daemon/core/rpc"
|
||||
"github.com/KristianJBorgwarth/dendrite.daemon/persistence"
|
||||
|
|
@ -30,7 +28,6 @@ type InitializeHandler struct{}
|
|||
func (h InitializeHandler) Handle(raw json.RawMessage) (any, *rpc.Error) {
|
||||
var params initializeCommand
|
||||
|
||||
slog.Info("initializing with params", "params", string(raw))
|
||||
if err := json.Unmarshal(raw, ¶ms); err != nil {
|
||||
return nil, &rpc.Error{
|
||||
Code: -32602,
|
||||
|
|
|
|||
BIN
dendrite
BIN
dendrite
Binary file not shown.
|
|
@ -4,6 +4,7 @@ import (
|
|||
"database/sql"
|
||||
"embed"
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
)
|
||||
|
|
@ -12,7 +13,14 @@ import (
|
|||
var migrationsFS embed.FS
|
||||
|
||||
func InitializeIndex(vaultPath string) error {
|
||||
dbPath := filepath.Join(vaultPath, "index.db")
|
||||
indexDir := filepath.Join(vaultPath, ".index")
|
||||
|
||||
if err := os.MkdirAll(indexDir, 0755); err != nil {
|
||||
slog.Error("failed to create index directory", "error", err)
|
||||
return err
|
||||
}
|
||||
|
||||
dbPath := filepath.Join(indexDir, "index.db")
|
||||
|
||||
db, err := sql.Open("sqlite", dbPath)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue