Skip to content

Commit

Permalink
Revert "set storage in context"
Browse files Browse the repository at this point in the history
This reverts commit 4477cc9.
  • Loading branch information
gernest committed Feb 10, 2024
1 parent b238324 commit dc76d40
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
11 changes: 0 additions & 11 deletions db/persistance.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package db

import (
"bytes"
"context"
"errors"
"fmt"
"log/slog"
Expand Down Expand Up @@ -201,16 +200,6 @@ type KV struct {
db *badger.DB
}

type dbKey struct{}

func With(ctx context.Context, kv Storage) context.Context {
return context.WithValue(ctx, dbKey{}, kv)
}

func Get(ctx context.Context) Storage {
return ctx.Value(dbKey{}).(Storage)
}

func NewKV(path string) (*KV, error) {
db, err := badger.Open(badger.DefaultOptions(filepath.Join(path, "db")).
WithLogger(&badgerLogger{
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func app() *cli.Command {
if err != nil {
return err
}
ctx = db.With(ctx, store)

log.Info("Setup session")
alloc := memory.NewGoAllocator()
log.Info("Loading primary index")
Expand Down

0 comments on commit dc76d40

Please sign in to comment.