Skip to content

Commit

Permalink
test(journal): extend test with another append and read
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiont-stevan-andjelkovic committed Jan 17, 2022
1 parent 9ce2980 commit c988b8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/journal/src/Journal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,21 @@ tj = do
opts = defaultOptions
allocateJournal fp opts
jour <- startJournal' fp opts

Just (offset, claimBuf) <- tryClaim jour 5
putStrLn ("offset: " ++ show offset)
putBS claimBuf hEADER_LENGTH (BSChar8.pack "hello")
commit claimBuf
Just bs <- readJournal' jour
putStrLn ("read bytestring: '" ++ BSChar8.unpack bs ++ "'")
putStrLn ("read bytestring 1: '" ++ BSChar8.unpack bs ++ "'")

Just (offset', claimBuf') <- tryClaim jour 5
putStrLn ("offset': " ++ show offset')
putBS claimBuf' hEADER_LENGTH (BSChar8.pack "world")
commit claimBuf'
Just bs' <- readJournal' jour
putStrLn ("read bytestring 2: '" ++ BSChar8.unpack bs' ++ "'")

dumpMetadata (jMetadata jour)
return ()

Expand Down
2 changes: 1 addition & 1 deletion src/journal/src/Journal/Internal/ByteBufferPtr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ boundCheck bb ix = do
where
errMsg = concat
[ prettyCallStack callStack
, "boundCheck: index out of bounds "
, "\nboundCheck: index out of bounds "
, "(", show ix, ",", show (unCapacity (getCapacity bb)), ")"
]

Expand Down

0 comments on commit c988b8c

Please sign in to comment.