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

fogfish / swarm / 11113666559

30 Sep 2024 08:30PM UTC coverage: 59.94% (-0.5%) from 60.391%
11113666559

push

github

web-flow
kernel v0.20.1 with minor improvements (#94)

18 of 53 new or added lines in 8 files covered. (33.96%)

3 existing lines in 3 files now uncovered.

998 of 1665 relevant lines covered (59.94%)

0.66 hits per line

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

50.0
/dequeue/dequeue.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 dequeue
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 receive and acknowledge messages of type T
18
func Typed[T any](q *kernel.Dequeuer, category ...string) (rcv <-chan swarm.Msg[T], ack chan<- swarm.Msg[T]) {
1✔
19
        return kernel.Dequeue(q,
1✔
20
                swarm.TypeOf[T](category...),
1✔
21
                encoding.NewCodecJson[T](),
1✔
22
        )
1✔
23
}
1✔
24

25
// Creates pair of channels to receive and acknowledge events of type T
26
func Event[M, T any](q *kernel.Dequeuer, category ...string) (<-chan swarm.Msg[swarm.Event[M, T]], chan<- swarm.Msg[swarm.Event[M, T]]) {
×
27
        cat := swarm.TypeOf[T](category...)
×
28

×
29
        return kernel.Dequeue(q, cat,
×
30
                encoding.NewCodecEvent[M, T](q.Config.Source, cat),
×
31
        )
×
32
}
×
33

34
// Create pair of channels to receive and acknowledge pure binary
35
func Bytes(q *kernel.Dequeuer, cat string) (<-chan swarm.Msg[[]byte], chan<- swarm.Msg[[]byte]) {
1✔
36
        if q.Config.PacketCodec != nil {
1✔
NEW
37
                return kernel.Dequeue(q, cat, q.Config.PacketCodec)
×
UNCOV
38
        }
×
39

40
        return kernel.Dequeue(q, cat, encoding.NewCodecByte())
1✔
41
}
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