holepunchto / dht-rpc

Make RPC calls over a Kademlia based DHT.
MIT License
196 stars 37 forks source link

v5 #27

Closed mafintosh closed 3 years ago

mafintosh commented 3 years ago

Will form the basis for Hyperswarm v5

davidmarkclements commented 3 years ago

if we're willing to drop Node 12 and below for v5 all private methods could be implemented as true private methods e.g.:

class HyperDHT extends DHT {
  constructor (opts = {}) {
    super({ bootstrap: BOOTSTRAP_NODES, ...opts })
    this.on('persistent', this.#ondhtpersistent)
  }
  #ondhtpersistent () {
    this.persistent = new PersistentNode(this)
  }
}

also we could use instance prop shorthand for both public and private:

class HyperDHT extends DHT {
  persistent = null
  #somethingPrivate = true
  constructor (opts = {}) {
    super({ bootstrap: BOOTSTRAP_NODES, ...opts })
    this.on('persistent', this.#ondhtpersistent)
  }
  #ondhtpersistent () {
    this.persistent = new PersistentNode(this)
  }
}

(node 12 is EOL in 10 months)

mafintosh commented 3 years ago

@davidmarkclements super down to look at the private props/methods later - merging for now as it should all work now for the RC