From 2c78e93222cc9d3b88456175348e42f7f40c449b Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Tue, 6 Jul 2021 17:30:31 +0300 Subject: Rework ephemeral and binary heaps Implemented a sync.Cond for binary heap algo to save processor from spinning in the for loop and receiving nil Items until the Queue will be filled. Add num_pollers option to the configuration to specify number of pollers from the queue. Add Resume, ResumeAll, Stop, StopAll, PushBatch methods to the ephemeral. Remove map and use sync.Map in the ephemeral broker. Add protobuf schema. Signed-off-by: Valery Piashchynski --- utils/pointers.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 utils/pointers.go (limited to 'utils') diff --git a/utils/pointers.go b/utils/pointers.go new file mode 100644 index 00000000..9c192279 --- /dev/null +++ b/utils/pointers.go @@ -0,0 +1,15 @@ +package utils + +func AsUint64Ptr(val uint64) *uint64 { + if val == 0 { + val = 10 + } + return &val +} + +func AsStringPtr(val string) *string { + if val == "" { + return nil + } + return &val +} -- cgit v1.2.3