Files
Go_I2p/lib/netdb/netdb.go
idk 0ec4f55fa9 Check in unchecked-in common library fixes, start implementing transports.
Since I turned out to be implementing parts of Noise which I did not need to implement, I'm taking a different approach, and doing an unmodified Noise transport first and then making our modifications to it. That should reduce what I need to do to message pre-processing mostly, I think.
2022-07-11 23:41:58 -04:00

41 lines
1.3 KiB
Go

package netdb
import (
"time"
"github.com/go-i2p/go-i2p/lib/bootstrap"
common "github.com/go-i2p/go-i2p/lib/common/data"
"github.com/go-i2p/go-i2p/lib/common/router_info"
)
// resolves unknown RouterInfos given the hash of their RouterIdentity
type Resolver interface {
// resolve a router info by hash
// return a chan that yields the found RouterInfo or nil if it could not be found after timeout
Lookup(hash common.Hash, timeout time.Duration) chan router_info.RouterInfo
}
// i2p network database, storage of i2p RouterInfos
type NetworkDatabase interface {
// obtain a RouterInfo by its hash locally
// return a RouterInfo if we found it locally
// return nil if the RouterInfo cannot be found locally
GetRouterInfo(hash common.Hash) router_info.RouterInfo
// store a router info locally
StoreRouterInfo(ri router_info.RouterInfo)
// try obtaining more peers with a bootstrap instance until we get minRouters number of router infos
// returns error if bootstrap.GetPeers returns an error otherwise returns nil
Reseed(b bootstrap.Bootstrap, minRouters int) error
// return how many router infos we have
Size() int
// Recaculate size of netdb from backend
RecalculateSize() error
// ensure underlying resources exist , i.e. directories, files, configs
Ensure() error
}