Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
niinivaa committed Jun 16, 2021
1 parent d42312d commit a2cb9db
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea/
tests/
!tests/*.nim
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

An in-process multi-threading non-blocking topic-based loosely-coupled ring-buffered generic publish/subscribe engine with microsecond-scale performance supporting delivery:
- when a message is published
- when triggered (e.g. timer-based periodical delivery)
- when triggered (e.g., timer-based periodical delivery)
- when a given number of new messages are available for delivery
- when message cache size is about to exceed some threshold
- when some undelivered messages are about to be evicted from cache
- when client requests (e.g. pull-based delivery or specific redelivery for state syncing)
- when client requests (e.g., pull-based delivery or specific redelivery for state syncing)

## [Documentation](http://olliniinivaara.github.io/Suber/)

## Installation

`nimble install https://github.com/olliNiinivaara/Suber`
`nimble install Suber`

also note that Suber requires gc:arc/orc compiler switch

Expand Down
4 changes: 2 additions & 2 deletions suber.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.9.9"
version = "1.0.0"
author = "Olli"
description = "Pub/Sub engine"
license = "MIT"
Expand All @@ -9,4 +9,4 @@ srcDir = "src"

# Dependencies

requires "nim >= 1.4.2", "stashtable >= 1.2.0"
requires "nim >= 1.4.8", "stashtable >= 1.2.1"
1 change: 0 additions & 1 deletion tests/test_cache.nim

This file was deleted.

17 changes: 14 additions & 3 deletions tests/test_delivery.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ const DeliveryCount = 10000
const ThreadCount = 4
const TopicCount = 1

var pushedmessages, aDeliveredmessages, bDeliveredmessages: IntSet
var
pushedmessages = initIntSet()
aDeliveredmessages = initIntSet()
bDeliveredmessages = initIntSet()

proc onADeliver(messages: openArray[ptr SuberMessage[int]]) =
{.gcsafe.}:
Expand All @@ -28,7 +31,7 @@ proc run(t: int) =
while i != DeliveryCount:
i.inc
if i mod 1000 == 0: a.doDelivery()
let data = i+(t*DeliveryCount)
var data = i+(t*DeliveryCount)
a.push(1.Topic, data)
b.push(1.Topic, data, 1)
withLock(lock): pushedmessages.incl(data)
Expand All @@ -48,4 +51,12 @@ doAssert(pushedmessages.len == aDeliveredmessages.len)
doAssert(aDeliveredmessages.len == bDeliveredmessages.len)
echo "ok"
echo "a Max channel queue length: ", a.getChannelQueueLengths[2]
echo "b Max channel queue length: ", b.getChannelQueueLengths[2]
echo "b Max channel queue length: ", b.getChannelQueueLengths[2]
sleep(1000)

#--------------------------
# gc:orc may SIGSEGV here, it is not a Suber bug!
pushedmessages.clear()
aDeliveredmessages.clear()
bDeliveredmessages.clear()
#--------------------------

0 comments on commit a2cb9db

Please sign in to comment.