Class NetworkDatabaseFacade

    • Constructor Detail

      • NetworkDatabaseFacade

        public NetworkDatabaseFacade()
    • Method Detail

      • findNearestRouters

        public abstract Set<Hash> findNearestRouters​(Hash key,
                                                     int maxNumRouters,
                                                     Set<Hash> peersToIgnore)
        Return the RouterInfo structures for the routers closest to the given key. At most maxNumRouters will be returned
        Parameters:
        key - The key
        maxNumRouters - The maximum number of routers to return
        peersToIgnore - Hash of routers not to include
      • lookupLocally

        public abstract DatabaseEntry lookupLocally​(Hash key)
        Returns:
        RouterInfo, LeaseSet, or null
        Since:
        0.8.3
      • lookupLocallyWithoutValidation

        public abstract DatabaseEntry lookupLocallyWithoutValidation​(Hash key)
        Not for use without validation
        Returns:
        RouterInfo, LeaseSet, or null, NOT validated
        Since:
        0.9.38
      • lookupLeaseSet

        public abstract void lookupLeaseSet​(Hash key,
                                            Job onFindJob,
                                            Job onFailedLookupJob,
                                            long timeoutMs)
      • lookupLeaseSet

        public abstract void lookupLeaseSet​(Hash key,
                                            Job onFindJob,
                                            Job onFailedLookupJob,
                                            long timeoutMs,
                                            Hash fromLocalDest)
        Lookup using the client's tunnels
        Parameters:
        fromLocalDest - use these tunnels for the lookup, or null for exploratory
        Since:
        0.9.10
      • lookupLeaseSetLocally

        public abstract LeaseSet lookupLeaseSetLocally​(Hash key)
      • lookupRouterInfo

        public abstract void lookupRouterInfo​(Hash key,
                                              Job onFindJob,
                                              Job onFailedLookupJob,
                                              long timeoutMs)
      • lookupRouterInfoLocally

        public abstract RouterInfo lookupRouterInfoLocally​(Hash key)
      • lookupLeaseSetRemotely

        public abstract void lookupLeaseSetRemotely​(Hash key,
                                                    Hash fromLocalDest)
        Unconditionally lookup using the client's tunnels. No success or failed jobs, no local lookup, no checks. Use this to refresh a leaseset before expiration.
        Parameters:
        fromLocalDest - use these tunnels for the lookup, or null for exploratory
        Since:
        0.9.25
      • lookupLeaseSetRemotely

        public abstract void lookupLeaseSetRemotely​(Hash key,
                                                    Job onFindJob,
                                                    Job onFailedLookupJob,
                                                    long timeoutMs,
                                                    Hash fromLocalDest)
        Unconditionally lookup using the client's tunnels.
        Parameters:
        fromLocalDest - use these tunnels for the lookup, or null for exploratory
        onFindJob - may be null
        onFailedLookupJob - may be null
        Since:
        0.9.47
      • lookupDestination

        public abstract void lookupDestination​(Hash key,
                                               Job onFinishedJob,
                                               long timeoutMs,
                                               Hash fromLocalDest)
        Lookup using the client's tunnels Succeeds even if LS validation fails due to unsupported sig type
        Parameters:
        fromLocalDest - use these tunnels for the lookup, or null for exploratory
        Since:
        0.9.16
      • lookupDestinationLocally

        public abstract Destination lookupDestinationLocally​(Hash key)
        Lookup locally in netDB and in badDest cache Succeeds even if LS validation failed due to unsupported sig type
        Since:
        0.9.16
      • publish

        public abstract void publish​(LeaseSet localLeaseSet)
      • unpublish

        public abstract void unpublish​(LeaseSet localLeaseSet)
      • fail

        public abstract void fail​(Hash dbEntry)
      • getLastRouterInfoPublishTime

        public long getLastRouterInfoPublishTime()
        The last time we successfully published our RI.
        Since:
        0.9.9
      • getAllRouters

        public abstract Set<Hash> getAllRouters()
      • getKnownRouters

        public int getKnownRouters()
      • getKnownLeaseSets

        public int getKnownLeaseSets()
      • isInitialized

        public boolean isInitialized()
      • rescan

        public void rescan()
      • getLeases

        public Set<LeaseSet> getLeases()
        public for NetDbRenderer in routerconsole
      • getRouters

        public Set<RouterInfo> getRouters()
        public for NetDbRenderer in routerconsole
      • reseedChecker

        public ReseedChecker reseedChecker()
        Since:
        0.9
      • floodfillEnabled

        public boolean floodfillEnabled()
        For convenience, so users don't have to cast to FNDF, and unit tests using Dummy NDF will work.
        Returns:
        false; FNDF overrides to return actual setting
        Since:
        IPv6
      • isNegativeCachedForever

        public boolean isNegativeCachedForever​(Hash key)
        Is it permanently negative cached?
        Parameters:
        key - only for Destinations; for RouterIdentities, see Banlist
        Since:
        0.9.16
      • getBlindData

        public BlindData getBlindData​(SigningPublicKey spk)
        Parameters:
        spk - unblinded key
        Returns:
        BlindData or null
        Since:
        0.9.40
      • setBlindData

        public void setBlindData​(BlindData bd)
        Parameters:
        bd - new BlindData to put in the cache
        Since:
        0.9.40
      • getBlindData

        public List<BlindData> getBlindData()
        For console ConfigKeyringHelper
        Since:
        0.9.41
      • removeBlindData

        public boolean removeBlindData​(SigningPublicKey spk)
        For console ConfigKeyringHelper
        Returns:
        true if removed
        Since:
        0.9.41
      • routingKeyChanged

        public void routingKeyChanged()
        Notify the netDB that the routing key changed at midnight UTC
        Since:
        0.9.50