Skip to content

Commit fa2e25d

Browse files
committed
fn: remove lru dependency
1 parent 364d79e commit fa2e25d

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

fn/conc_queue.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package fn
22

33
import (
44
"sync"
5-
6-
"github.com/lightninglabs/neutrino/cache/lru"
75
)
86

97
// ConcurrentQueue is a typed concurrent-safe FIFO queue with unbounded
@@ -17,21 +15,21 @@ type ConcurrentQueue[T any] struct {
1715

1816
chanIn chan T
1917
chanOut chan T
20-
overflow *lru.List[T]
18+
overflow *List[T]
2119

2220
wg sync.WaitGroup
2321
quit chan struct{}
2422
}
2523

2624
// NewConcurrentQueue constructs a ConcurrentQueue. The bufferSize parameter is
2725
// the capacity of the output channel. When the size of the queue is below this
28-
// threshold, pushes do n[?12;4$yot incur the overhead of the less efficient overflow
26+
// threshold, pushes do not incur the overhead of the less efficient overflow
2927
// structure.
3028
func NewConcurrentQueue[T any](bufferSize int) *ConcurrentQueue[T] {
3129
return &ConcurrentQueue[T]{
3230
chanIn: make(chan T),
3331
chanOut: make(chan T, bufferSize),
34-
overflow: lru.NewList[T](),
32+
overflow: NewList[T](),
3533
quit: make(chan struct{}),
3634
}
3735
}

fn/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ module github.com/lightningnetwork/lnd/fn
33
go 1.19
44

55
require (
6-
github.com/lightninglabs/neutrino/cache v1.1.2
76
github.com/stretchr/testify v1.8.1
87
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b
8+
golang.org/x/sync v0.7.0
99
)
1010

1111
require (

fn/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
22
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4-
github.com/lightninglabs/neutrino/cache v1.1.2 h1:C9DY/DAPaPxbFC+xNNEI/z1SJY9GS3shmlu5hIQ798g=
5-
github.com/lightninglabs/neutrino/cache v1.1.2/go.mod h1:XJNcgdOw1LQnanGjw8Vj44CvguYA25IMKjWFZczwZuo=
64
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
75
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
86
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -14,6 +12,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
1412
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
1513
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b h1:kLiC65FbiHWFAOu+lxwNPujcsl8VYyTYYEZnsOO1WK4=
1614
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
15+
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
16+
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
1717
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1818
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1919
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)