dhtring

package
v0.0.0-...-7a4b066 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package dhtring - provides operations like find a closest node, add new and remove for a Distributed Hash Table Ring data structure

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ring

type Ring struct {
	// contains filtered or unexported fields
}

Ring is a struct to store the DHT Ring to store 32-bytes hex

func CreateRing

func CreateRing() *Ring

CreateRing creates a new ring data structure

func (*Ring) GetClosest

func (r *Ring) GetClosest(hex string, num int, exclude string) []string

GetClosest gets the closest hexes close to the given hex

func (*Ring) Insert

func (r *Ring) Insert(hex string)

Insert inserts a hex string into the ring

func (*Ring) Remove

func (r *Ring) Remove(hex string)

Remove inserts a given hex string out of the ring

func (*Ring) Size

func (r *Ring) Size() int

Size gets the size of the ring

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL