public class NodeUpdateManager
extends java.lang.Object
Supervises NodeUpdater's. Enables us to easily update multiple files, change the URI's on the fly, eliminates some messy code in the callbacks etc.
Procedure for updating the update key: Create a new key. Create a new build X, the "transition version". This must be UOM-compatible with the previous transition version. UOM-compatible means UOM should work from the older builds. This in turn means that it should support an overlapping set of connection setup negTypes (@link FNPPacketMangler.supportedNegTypes()). Similarly there may be issues with changes to the UOM messages, or to messages in general. Build X is inserted to both the old key and the new key. Build X's SSK URI (on the old auto-update key) will be hard-coded as the new transition version. Then the next build, X+1, can get rid of some of the back compatibility cruft (especially old connection setup types), and will be inserted only to the new key. Secure backups of the new key are required and are documented elsewhere.
FIXME: See bug #6009 for some current UOM compatibility issues.Modifier and Type | Class and Description |
---|---|
class |
NodeUpdateManager.UpdateRevocationURICallback |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LEGACY_UPDATE_URI
The URI for post-TRANSITION_VERSION builds' freenet.jar on EoL JVMs.
|
static long |
MAX_IP_TO_COUNTRY_LENGTH |
static long |
MAX_JAVA_INSTALLER_LENGTH |
static long |
MAX_MAIN_JAR_LENGTH |
static long |
MAX_REVOCATION_KEY_BLOB_LENGTH |
static long |
MAX_REVOCATION_KEY_LENGTH |
static long |
MAX_REVOCATION_KEY_TEMP_LENGTH |
static long |
MAX_SEEDNODES_LENGTH |
static long |
MAX_WINDOWS_INSTALLER_LENGTH |
Node |
node |
static java.lang.String |
PREVIOUS_UPDATE_URI
The URI for freenet.jar before the updater was rekeyed.
|
static java.lang.String |
REVOCATION_URI |
static int |
TRANSITION_VERSION
The last build on the previous key with Java 7 support.
|
java.io.File |
transitionMainJarFile |
static java.lang.String |
transitionMainJarFilename |
UpdateOverMandatoryManager |
uom |
static java.lang.String |
UPDATE_URI
The URI for post-TRANSITION_VERSION builds' freenet.jar on modern JVMs.
|
Constructor and Description |
---|
NodeUpdateManager(Node node,
Config config) |
Modifier and Type | Method and Description |
---|---|
void |
addChangelogLinks(long version,
HTMLNode node)
Add links to the changelog for the given version to the given node.
|
void |
arm() |
void |
blow(java.lang.String msg,
boolean disabledNotBlown) |
boolean |
brokenDependencies() |
boolean |
canUpdateImmediately()
Is the node able to update *immediately*? (i.e.
|
boolean |
canUpdateNow()
Is the node able to update as soon as the revocation fetch has been
completed?
|
void |
deployPlugin(java.lang.String fn) |
void |
deployPluginWhenReady(java.lang.String fn) |
void |
disableThisSession() |
void |
disconnected(PeerNode pn) |
boolean |
dontAllowUOM() |
boolean |
fetchingFromUOM() |
boolean |
fetchingNewMainJar() |
int |
fetchingNewMainJarVersion() |
FreenetURI |
getChangelogURI() |
java.io.File |
getCurrentVersionBlobFile() |
FreenetURI |
getDeveloperChangelogURI() |
int |
getExtVersion() |
java.io.File |
getInstallerNonWindows() |
FreenetURI |
getInstallerNonWindowsURI() |
java.io.File |
getInstallerWindows() |
FreenetURI |
getInstallerWindowsURI() |
FreenetURI |
getIPv4ToCountryURI() |
java.io.File |
getMainBlob(int version) |
int |
getMainVersion()
What version is the node currently running?
|
int |
getRevocationDNFCounter() |
FreenetURI |
getRevocationURI() |
FreenetURI |
getSeednodesURI() |
protected long |
getStartedFetchingNextMainJarTimestamp() |
java.io.File |
getTransitionMainBlob() |
FreenetURI |
getURI()
Get the URI for freenet.jar.
|
boolean |
hasNewMainJar() |
boolean |
inFinalCheck() |
boolean |
isArmed() |
boolean |
isAutoUpdateAllowed() |
boolean |
isBlown()
Has the private key been revoked?
|
boolean |
isEnabled()
Is auto-update enabled?
|
protected void |
maybeBroadcastUOMAnnouncesNew() |
static NodeUpdateManager |
maybeCreate(Node node,
Config config)
Create a NodeUpdateManager.
|
void |
maybeSendUOMAnnounce(PeerNode peer) |
int |
newMainJarVersion()
What version has been fetched?
This includes jar's fetched via UOM, because the UOM code feeds its
results through the mainUpdater.
|
void |
noRevocationFound()
Called when the RevocationChecker has got 3 DNFs on the revocation key
|
void |
notPeerClaimsKeyBlown()
Called inside locks, so don't lock anything
|
void |
onDependenciesReady(freenet.node.updater.MainJarDependenciesChecker.MainJarDependencies deps)
Called when the dependencies have been verified and/or downloaded, and we
can upgrade to the new build without dependency issues.
|
void |
onStartFetchingUOM() |
void |
renderProgress(HTMLNode alertNode)
Show the progress of individual dependencies if possible
|
void |
setAutoUpdateAllowed(boolean val)
Enable or disable auto-update.
|
void |
setRevocationURI(FreenetURI uri)
Set the revocation URI.
|
void |
setURI(FreenetURI uri)
Set the URfrenet.jar should be updated from.
|
void |
start() |
void |
startPluginUpdater(java.lang.String plugName) |
void |
stopPluginUpdater(java.lang.String plugName) |
long |
timeRemainingOnCheck() |
void |
writeJarTo(java.io.File fNew) |
public static final int TRANSITION_VERSION
public static final java.lang.String UPDATE_URI
public static final java.lang.String LEGACY_UPDATE_URI
public static final java.lang.String PREVIOUS_UPDATE_URI
public static final java.lang.String REVOCATION_URI
public static final long MAX_REVOCATION_KEY_LENGTH
public static final long MAX_REVOCATION_KEY_TEMP_LENGTH
public static final long MAX_REVOCATION_KEY_BLOB_LENGTH
public static final long MAX_MAIN_JAR_LENGTH
public static final long MAX_JAVA_INSTALLER_LENGTH
public static final long MAX_WINDOWS_INSTALLER_LENGTH
public static final long MAX_IP_TO_COUNTRY_LENGTH
public static final long MAX_SEEDNODES_LENGTH
public static final java.lang.String transitionMainJarFilename
public final java.io.File transitionMainJarFile
public final Node node
public final UpdateOverMandatoryManager uom
public NodeUpdateManager(Node node, Config config) throws InvalidConfigValueException
InvalidConfigValueException
public java.io.File getInstallerWindows()
public java.io.File getInstallerNonWindows()
public FreenetURI getSeednodesURI()
public FreenetURI getInstallerNonWindowsURI()
public FreenetURI getInstallerWindowsURI()
public FreenetURI getIPv4ToCountryURI()
public void start() throws InvalidConfigValueException
InvalidConfigValueException
public void maybeSendUOMAnnounce(PeerNode peer)
public boolean isEnabled()
public void startPluginUpdater(java.lang.String plugName)
plugName
- The filename for loading/config purposes for an official
plugin. E.g. "Library" (no .jar)public void stopPluginUpdater(java.lang.String plugName)
public static NodeUpdateManager maybeCreate(Node node, Config config) throws InvalidConfigValueException
node
- The node object.config
- The global config object. Options will be added to a subconfig
called node.updater.InvalidConfigValueException
- If there is an error in the config.public FreenetURI getURI()
public FreenetURI getChangelogURI()
public FreenetURI getDeveloperChangelogURI()
public void addChangelogLinks(long version, HTMLNode node)
version
- USK edition to point tonode
- to add links topublic void setURI(FreenetURI uri)
uri
- The URI to set.public FreenetURI getRevocationURI()
public void setRevocationURI(FreenetURI uri)
uri
- The new revocation URI.public boolean isAutoUpdateAllowed()
public void setAutoUpdateAllowed(boolean val)
val
- If true, enable auto-update (and immediately update if an
update is ready). If false, disable it.public void writeJarTo(java.io.File fNew) throws java.io.IOException
java.io.IOException
public void blow(java.lang.String msg, boolean disabledNotBlown)
msg
- disabledNotBlown
- If true, the auto-updating system is broken, and should be
disabled, but the problem *could* be local e.g. out of disk
space and a node sends us a revocation certificate.public void noRevocationFound()
public void arm()
protected void maybeBroadcastUOMAnnouncesNew()
public boolean isBlown()
public boolean hasNewMainJar()
public int newMainJarVersion()
public boolean fetchingNewMainJar()
public int fetchingNewMainJarVersion()
public boolean inFinalCheck()
public int getRevocationDNFCounter()
public int getMainVersion()
public int getExtVersion()
public boolean isArmed()
public boolean canUpdateNow()
public boolean canUpdateImmediately()
public void notPeerClaimsKeyBlown()
public java.io.File getMainBlob(int version)
public long timeRemainingOnCheck()
public void disableThisSession()
protected long getStartedFetchingNextMainJarTimestamp()
public void disconnected(PeerNode pn)
public void deployPlugin(java.lang.String fn) throws java.io.IOException
java.io.IOException
public void deployPluginWhenReady(java.lang.String fn) throws java.io.IOException
java.io.IOException
public boolean dontAllowUOM()
public boolean fetchingFromUOM()
public void onDependenciesReady(freenet.node.updater.MainJarDependenciesChecker.MainJarDependencies deps)
deps
- The dependencies object. Used to rewrite wrapper.conf if
necessary. Also contains the build number.binaryBlob
- The binary blob for this build, including the dependencies.public java.io.File getTransitionMainBlob()
public void renderProgress(HTMLNode alertNode)
public boolean brokenDependencies()
public void onStartFetchingUOM()
public java.io.File getCurrentVersionBlobFile()