Skip to content

Commit

Permalink
refactor(core): Use kv based context to avoid allocations (#4986)
Browse files Browse the repository at this point in the history
* refactor(core): Use kv based context to avoid allocations

Signed-off-by: Xuanwo <[email protected]>

* Remove logger test

Signed-off-by: Xuanwo <[email protected]>

---------

Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo authored Aug 9, 2024
1 parent c5cc990 commit dac28d1
Show file tree
Hide file tree
Showing 4 changed files with 676 additions and 442 deletions.
12 changes: 1 addition & 11 deletions bindings/haskell/test/BasicTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ basicTests =
"Basic Tests"
[ testCase "testBasicOperation" testRawOperation,
testCase "testMonad" testMonad,
testCase "testError" testError,
testCase "testLogger" testLogger
testCase "testError" testError
]

testRawOperation :: Assertion
Expand Down Expand Up @@ -102,15 +101,6 @@ testError = do
where
operation = readOp "non-exist-path"

testLogger :: Assertion
testLogger = do
state <- newIORef ""
let logger initStr msg = modifyIORef' initStr (<> msgText msg)
let logFn = LogAction $ logger state
Right _ <- newOperator "memory" {ocLogAction = Just logFn}
logStr <- readIORef state
T.take 78 logStr @?= "service=memory operation=metadata -> startedservice=memory operation=metadata"

-- helper function

(?=) :: (MonadIO m, Eq a, Show a) => m a -> a -> m ()
Expand Down
Loading

0 comments on commit dac28d1

Please sign in to comment.