Skip to content

Commit

Permalink
rip out modulecontext.Map
Browse files Browse the repository at this point in the history
  • Loading branch information
deniseli committed Jun 5, 2024
1 parent a0f98b3 commit bd3849a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 7 additions & 3 deletions go-runtime/ftl/ftltest/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ import (

type fakeFTL struct {
fsm *fakeFSMManager
mockMaps map[uintptr]modulecontext.Map
mockMaps map[uintptr]mapImpl
}

// mapImpl is a function that takes an object and returns an object of a potentially different
// type but is not constrained by input/output type like ftl.Map.
type mapImpl func(context.Context) (any, error)

func newFakeFTL() *fakeFTL {
return &fakeFTL{
fsm: newFakeFSMManager(),
mockMaps: make(map[uintptr]modulecontext.Map),
mockMaps: make(map[uintptr]mapImpl),
}
}

Expand Down Expand Up @@ -62,7 +66,7 @@ func makeMapKey(mapper any) uintptr {
return v.Pointer()
}

func actuallyCallMap(ctx context.Context, impl modulecontext.Map) any {
func actuallyCallMap(ctx context.Context, impl mapImpl) any {
out, err := impl(ctx)
if err != nil {
panic(err)
Expand Down
5 changes: 0 additions & 5 deletions internal/modulecontext/module_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ import (
// It is used for definitions of mock verbs as well as real implementations of verbs to directly execute
type Verb func(ctx context.Context, req any) (resp any, err error)

// Map is a function that takes an object and returns an object of a potentially different type but is not constrained by input/output type like ftl.Map
//
// It is used for definitions of mock maps as well as real implementations of maps to directly execute
type Map func(context.Context) (any, error)

// ModuleContext holds the context needed for a module, including configs, secrets and DSNs
//
// ModuleContext is immutable
Expand Down

0 comments on commit bd3849a

Please sign in to comment.