• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

fogfish / swarm / 13873166240

15 Mar 2025 01:08PM UTC coverage: 59.373% (-1.9%) from 61.277%
13873166240

push

github

web-flow
update kernel api - unified support for events and codecs (#117)

* update kernel api - unified support for events and codecs
* go version 1.24

66 of 155 new or added lines in 8 files covered. (42.58%)

56 existing lines in 5 files now uncovered.

1023 of 1723 relevant lines covered (59.37%)

0.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.95
/enqueue/enqueue.go
1
//
2
// Copyright (C) 2021 - 2024 Dmitry Kolesnikov
3
//
4
// This file may be modified and distributed under the terms
5
// of the Apache License Version 2.0. See the LICENSE file for details.
6
// https://github.com/fogfish/swarm
7
//
8

9
package enqueue
10

11
import (
12
        "github.com/fogfish/swarm"
13
        "github.com/fogfish/swarm/kernel"
14
        "github.com/fogfish/swarm/kernel/encoding"
15
)
16

17
// Creates pair of channels to emit messages of type T
18
func Typed[T any](q *kernel.Enqueuer, codec ...kernel.Encoder[T]) (snd chan<- T, dlq <-chan T) {
1✔
19
        var c kernel.Encoder[T]
1✔
20
        if len(codec) == 0 {
2✔
21
                c = encoding.ForTyped[T]()
1✔
22
        } else {
1✔
NEW
23
                c = codec[0]
×
NEW
24
        }
×
25

26
        return kernel.Enqueue(q, c.Category(), c)
1✔
27
}
28

29
// Creates pair of channels to emit events of type T
30
func Event[M, T any](q *kernel.Enqueuer, codec ...kernel.Encoder[swarm.Event[M, T]]) (snd chan<- swarm.Event[M, T], dlq <-chan swarm.Event[M, T]) {
1✔
31
        var c kernel.Encoder[swarm.Event[M, T]]
1✔
32
        if len(codec) == 0 {
2✔
33
                c = encoding.ForEvent[M, T](q.Config.Source)
1✔
34
        } else {
1✔
NEW
35
                c = codec[0]
×
NEW
36
        }
×
37

38
        return kernel.Enqueue(q, c.Category(), c)
1✔
39
}
40

41
// Create pair of channels to emit pure binaries
42
func Bytes(q *kernel.Enqueuer, codec kernel.Encoder[[]byte]) (snd chan<- []byte, dlq <-chan []byte) {
1✔
43
        return kernel.Enqueue(q, codec.Category(), codec)
1✔
44
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc