An abstract library that implements a topic-based publish/subscribe mechanism, and using the concept of the digital twins that include the interfaces to bind remote service providers, achieves the decoupling from specific network protocol libraries.
- 100.0% of statements
- cabinet (Using the tree-structure topics manager.)
- kademlia (Used for the twin‘s identity, cause support the distributed system.)
- bytesutil (Used for the binary codec.)
- testify (Used in testing.)
- goleak (Used in testing.)
At first, it was to build a stream-based message-hub service over the peer-to-peer network,
which does not rely on the MQTT protocol. With the introduction of twin concept,
it can be completely decoupled from the communication module, so that a peer-to-peer network is only an option,
which can be a traditional cluster or a single-point server, and which can use the TCP or UDP protocol.
So it has stronger flexibility and versatility.
% sysctl -a | grep machdep.cpu | grep 'brand_'
machdep.cpu.brand_string: Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
% go test . -cover -v
=== RUN TestPacket
--- PASS: TestPacket (0.00s)
=== RUN TestPublishWorker
--- PASS: TestPublishWorker (0.01s)
=== RUN TestPublishWorkerForMultipleSubscribe
--- PASS: TestPublishWorkerForMultipleSubscribe (0.01s)
=== RUN TestSubscribeWorker
--- PASS: TestSubscribeWorker (0.00s)
=== RUN TestTaskPool
--- PASS: TestTaskPool (0.00s)
=== RUN TestTwinsPool
--- PASS: TestTwinsPool (0.02s)
PASS
coverage: 100.0% of statements
ok github.com/TheSmallBoat/marina 0.138s coverage: 100.0% of statements
% go test -bench=. -benchtime=10s
goos: darwin
goarch: amd64
pkg: github.com/TheSmallBoat/marina
BenchmarkTaskPool-4 34860289 348 ns/op 0 B/op 0 allocs/op
BenchmarkTwinsPool-4 19888471 599 ns/op 2336.85 MB/s 40 B/op 3 allocs/op
PASS
ok github.com/TheSmallBoat/marina 25.257s