Skip to content

Commit

Permalink
Remove eds locker and pass context
Browse files Browse the repository at this point in the history
  • Loading branch information
carabasdaniel committed Oct 26, 2023
1 parent 1fd6432 commit ed94145
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 31 deletions.
6 changes: 4 additions & 2 deletions eds.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package eds

import (
"context"

"github.com/aserto-dev/go-edge-ds/pkg/directory"
"github.com/rs/zerolog"
)

func New(config *directory.Config, logger *zerolog.Logger) (*directory.Directory, error) {
func New(ctx context.Context, config *directory.Config, logger *zerolog.Logger) (*directory.Directory, error) {
newLogger := logger.With().Str("component", "edge-ds").Logger()

ds, err := directory.New(config, &newLogger)
ds, err := directory.New(ctx, config, &newLogger)
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/directory/directory.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package directory

import (
"context"
"errors"
"time"

Expand Down Expand Up @@ -53,7 +54,7 @@ type Directory struct {
writer3 dsw3.WriterServer
}

func New(config *Config, logger *zerolog.Logger) (*Directory, error) {
func New(ctx context.Context, config *Config, logger *zerolog.Logger) (*Directory, error) {
newLogger := logger.With().Str("component", "directory").Logger()

cfg := bdb.Config{
Expand Down
27 changes: 0 additions & 27 deletions pkg/server/eds-lock.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/server/test-edge-ds.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func NewTestEdgeServer(ctx context.Context, logger *zerolog.Logger, cfg *directo

edgeDSLogger := logger.With().Str("component", "api.edge-directory").Logger()

edgeDirServer, err := eds.New(cfg, &edgeDSLogger)
edgeDirServer, err := eds.New(context.Background(), cfg, &edgeDSLogger)
if err != nil {
logger.Error().Err(err).Msg("failed to start edge directory server")
}
Expand Down

0 comments on commit ed94145

Please sign in to comment.