dhtring

package
v0.0.0-...-7726842 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: Apache-2.0 Imports: 4 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) Dump

func (r *Ring) Dump()

Dump is for debugging use ONLY

func (*Ring) GetClosest

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

GetClosest gets the closest hexes close to the given hex

func (*Ring) GetWithinRange

func (r *Ring) GetWithinRange(startHex string, endHex string) ([]string, error)

GetWithinRange gets all entries within a range

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