feat: Waku v2 bridge

Issue #12610
This commit is contained in:
Michal Iskierko
2023-11-12 13:29:38 +01:00
parent 56e7bd01ca
commit 6d31343205
6716 changed files with 1982502 additions and 5891 deletions

24
vendor/github.com/meirf/gopart/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,24 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof

1
vendor/github.com/meirf/gopart/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1 @@
language: go

22
vendor/github.com/meirf/gopart/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

31
vendor/github.com/meirf/gopart/README.md generated vendored Normal file
View File

@@ -0,0 +1,31 @@
# Go Type-Agnostic Collection Partitioning
[![GoDoc](https://godoc.org/github.com/meirf/gopart?status.png)](https://godoc.org/github.com/meirf/gopart) [![Travis](https://travis-ci.org/meirf/gopart.svg?branch=master)](https://travis-ci.org/meirf/gopart)
Type-agnostic partitioning for anything that can be indexed in Go - slices, arrays,`string`s. Inspired by Guava's `Lists.partition`. This tiny library alleviates the issue of partitioning collections with wide ranging types - Go lacks generics - by returning consecutive index ranges that can be used on any indexable object.
## Usage
```go
...
// bigList can be any type
for idxRange := range gopart.Partition(len(bigList), partitionSize) {
bulkOperation(bigList[idxRange.Low:idxRange.High])
}
...
```
[Full Executable Example](http://play.golang.org/p/WlVPpejxFV)
## Installation
# install the library:
go get github.com/meirf/gopart
// use in your .go code:
import (
"github.com/meirf/gopart"
)
## Implementation
The partitioning is done with a separate goroutine that passes the index ranges to a channel. This requires the use of a for...range loop, but adds concurrency and lowers memory usage (no slice of index ranges is stored anywhere).

5
vendor/github.com/meirf/gopart/doc.go generated vendored Normal file
View File

@@ -0,0 +1,5 @@
// The gopart package alleviates the issue of partitioning
// collections with wide-ranging types by returning index
// ranges that can be used on any indexable object.
// Inspired by Guava's Lists.partition
package gopart

48
vendor/github.com/meirf/gopart/gopart.go generated vendored Normal file
View File

@@ -0,0 +1,48 @@
package gopart
// IdxRange specifies a single range. Low and High
// are the indexes in the larger collection at which this
// range begins and ends, respectively. Note that High
// is exclusive, whereas Low is inclusive.
type IdxRange struct {
Low, High int
}
// Partition enables type-agnostic partitioning
// of anything indexable by specifying the length and
// the desired partition size of the indexable object.
// Consecutive index ranges are sent to the channel,
// each of which is the same size. The final range may
// be smaller than the others.
//
// For example, a collection with length 8 and
// partition size 3 yields ranges:
// {0, 3}, {3, 6}, {6, 8}
//
// This method should be used in a for...range loop.
// No results will be returned if the partition size is
// nonpositive. If the partition size is greater than the
// collection length, the range returned includes the
// entire collection.
func Partition(collectionLen, partitionSize int) chan IdxRange {
c := make(chan IdxRange)
if partitionSize <= 0 {
close(c)
return c
}
go func() {
numFullPartitions := collectionLen / partitionSize
var i int
for ; i < numFullPartitions; i++ {
c <- IdxRange{Low: i * partitionSize, High: (i + 1) * partitionSize}
}
if collectionLen%partitionSize != 0 { // left over
c <- IdxRange{Low: i * partitionSize, High: collectionLen}
}
close(c)
}()
return c
}