Commit c89bc35e authored by tavit ohanian's avatar tavit ohanian

initial port

parent 153778c8
Pipeline #693 failed with stages
in 6 seconds
stages:
- build
- test
variables:
BUILD_DIR: "/tmp/$CI_CONCURRENT_PROJECT_ID"
before_script:
- mkdir -p $BUILD_DIR/src
- cd $BUILD_DIR/src
- if [ -d $CI_PROJECT_DIR ]
- then
- echo "soft link $CI_PROJECT_DIR exists"
- else
- echo "creating soft link $CI_PROJECT_DIR"
- ln -s $CI_PROJECT_DIR
- fi
- cd $CI_PROJECT_DIR
build:
stage: build
tags:
- testing
script:
- echo $CI_JOB_STAGE
- go build
test:
stage: test
tags:
- testing
script:
- echo $CI_JOB_STAGE
- go test -cover
coverage: '/coverage: \d+.\d+% of statements/'
This diff is collapsed.
package kademlia package kademlia
import ( import (
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
"github.com/libp2p/go-libp2p-xor/trie" "gitlab.dms3.io/p2p/go-p2p-xor/trie"
) )
// BucketAtDepth returns the bucket in the routing table at a given depth. // BucketAtDepth returns the bucket in the routing table at a given depth.
......
...@@ -4,8 +4,8 @@ import ( ...@@ -4,8 +4,8 @@ import (
"sort" "sort"
"testing" "testing"
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
"github.com/libp2p/go-libp2p-xor/trie" "gitlab.dms3.io/p2p/go-p2p-xor/trie"
) )
func randomTrie(count int, keySizeByte int) *trie.Trie { func randomTrie(count int, keySizeByte int) *trie.Trie {
......
...@@ -4,8 +4,8 @@ import ( ...@@ -4,8 +4,8 @@ import (
"encoding/json" "encoding/json"
"sort" "sort"
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
"github.com/libp2p/go-libp2p-xor/trie" "gitlab.dms3.io/p2p/go-p2p-xor/trie"
) )
// TableHealthReport describes the discrepancy between a node's routing table from the theoretical ideal, // TableHealthReport describes the discrepancy between a node's routing table from the theoretical ideal,
......
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
"math/rand" "math/rand"
"testing" "testing"
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
func TestTableHealthFromSets(t *testing.T) { func TestTableHealthFromSets(t *testing.T) {
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"math/big" "math/big"
"strings" "strings"
kbucket "github.com/libp2p/go-libp2p-kbucket" kbucket "gitlab.dms3.io/p2p/go-p2p-kbucket"
) )
func KbucketIDToKey(id kbucket.ID) Key { func KbucketIDToKey(id kbucket.ID) Key {
......
...@@ -5,8 +5,8 @@ import ( ...@@ -5,8 +5,8 @@ import (
"math/big" "math/big"
"testing" "testing"
kbucket "github.com/libp2p/go-libp2p-kbucket" kbucket "gitlab.dms3.io/p2p/go-p2p-kbucket"
ks "github.com/libp2p/go-libp2p-kbucket/keyspace" ks "gitlab.dms3.io/p2p/go-p2p-kbucket/keyspace"
) )
func TestKbucketConversion(t *testing.T) { func TestKbucketConversion(t *testing.T) {
......
package trie package trie
import ( import (
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
// Add adds the key q to the trie. Add mutates the trie. // Add adds the key q to the trie. Add mutates the trie.
......
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
"math/rand" "math/rand"
"testing" "testing"
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
// Verify mutable and immutable add do the same thing. // Verify mutable and immutable add do the same thing.
......
package trie package trie
import ( import (
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
type InvariantDiscrepancy struct { type InvariantDiscrepancy struct {
......
package trie package trie
import ( import (
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
func Equal(p, q *Trie) bool { func Equal(p, q *Trie) bool {
......
package trie package trie
import ( import (
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
// Find looks for the key q in the trie. // Find looks for the key q in the trie.
......
package trie package trie
import ( import (
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
func IntersectKeySlices(p, q []key.Key) []key.Key { func IntersectKeySlices(p, q []key.Key) []key.Key {
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"math/rand" "math/rand"
"testing" "testing"
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
func TestIntersectRandom(t *testing.T) { func TestIntersectRandom(t *testing.T) {
......
package trie package trie
import ( import (
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
// List returns a list of all keys in the trie. // List returns a list of all keys in the trie.
......
package trie package trie
import ( import (
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
// Remove removes the key q from the trie. Remove mutates the trie. // Remove removes the key q from the trie. Remove mutates the trie.
......
...@@ -3,7 +3,7 @@ package trie ...@@ -3,7 +3,7 @@ package trie
import ( import (
"encoding/json" "encoding/json"
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
// Trie is a trie for equal-length bit vectors, which stores values only in the leaves. // Trie is a trie for equal-length bit vectors, which stores values only in the leaves.
......
...@@ -3,7 +3,7 @@ package trie ...@@ -3,7 +3,7 @@ package trie
import ( import (
"testing" "testing"
"github.com/libp2p/go-libp2p-xor/key" "gitlab.dms3.io/p2p/go-p2p-xor/key"
) )
func TestInsertRemove(t *testing.T) { func TestInsertRemove(t *testing.T) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment