func load() []bucket { if storeExist() { // ... return nil } buckets := make([]bucket, 1) // An empty table has one bucket with an ID space range of min=0, max=2^160 buckets[0] = bucket{ min: node.SmallestID().Int(), max: node.BiggestID().Int(), nodes: make(map[string]*node.Node), lastChanged: time.Now(), } return buckets }
func main() { id := node.GenerateID() node1 := node.New(id) node2 := node.New(id) fmt.Println(node1.Distance(node2.ID())) fmt.Println("--------------") biggestID := node.BiggestID() fmt.Println(biggestID.String()) fmt.Println(biggestID.Int().String()) fmt.Println("--------------") for i := 0; i < 10; i++ { fmt.Println(node.GenerateID()) } }