Class FrontCacheClient
java.lang.Object
org.frontcache.client.FrontCacheClient
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intstatic final StringTheerrorDescriptionof every warmer call made to a node that does not know the action. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbackup()Triggers a backup of the on-disk (L2) index on the edge.deleteWarmerList(String name) downloadWarmerList(String name, OutputStream os) Streams a whole list intoos(raw=true) - never through memory, so a 64 MB list can pass through the console to a browser.dumpKeys()Triggers dumping of cached keys to a file on the edge (./warmer dir).booleangetBots()Deprecated.pre-2.7 shape: a single-entry map keyed by domain.The raw conf/bots.conf of this edge - what the console's Bot Configs screen renders.booleanWrites keys to provided output streamFetches all cached keys from the remote node and returns them as a Set.getConfigFile(ConfigFile configFile) The raw content of any of the five editable config files, by logical id.Deprecated.pre-2.7 shape: a single-entry map keyed by domain.The raw conf/dynamic-urls.conf of this edge - what the console's Dynamic URLs screen renders.Deprecated.pre-2.7 shape: a single-entry map keyed by domain.The raw conf/fallbacks.conf of this edge - what the console's Fallback Config screen renders.getFromCache(String key) Deprecated.pre-2.7 name ofgetResilienceConfig()Deprecated.pre-2.7 name ofgetResilienceConfigActionResponse()getName()http://localhost:8080/ -> localhost:8080The cheap, pollable view of a node - cache sizes per tier plus JVM heap, CPU and uptime.Asks for the raw resilience config, falling back to the pre-2.7 action name when the edge does not recognize the current one.getWarmerList(String name, String grep) inthashCode()purge()Triggers purge of expired entries on the edge.booleanputToCache(String key, WebResponse webResponse) Pushes a WebResponse entry into the remote node's cache.putWarmerList(String name, InputStream body, long length, String baseHash) Creates or replaces a list.Reloads the edge's conf/dynamic-urls.conf.Reloads the edge's conf/resilience.properties.removeFromCache(String filter) setConfig(ConfigFile configFile, String content, String baseHash, boolean apply) Writes one config file on the edge and applies it.toString()warmerUpdate(Long delayMs, Integer concurrency) A null leaves that setting as it is.
-
Field Details
-
CONNECTION_TIMEOUT
public static int CONNECTION_TIMEOUT -
WARMER_UNSUPPORTED
TheerrorDescriptionof every warmer call made to a node that does not know the action. Such a node answers with a ping, which parses into any response class withresponseStatus=OK- so without this, a start sent to an older node would be reported as a run that started. Reporting a run that never began is the worst outcome available here, and a mixed fleet is the normal state.- See Also:
-
-
Constructor Details
-
FrontCacheClient
-
-
Method Details
-
removeFromCache
-
removeFromCacheAll
- Returns:
-
purge
Triggers purge of expired entries on the edge.- Returns:
- raw edge response, or an error message string
-
backup
Triggers a backup of the on-disk (L2) index on the edge.- Returns:
- BackupActionResponse with the status message, or null if the edge is not available
-
getCacheState
-
getCacheStateActionResponse
- Returns:
-
getNodeStatsActionResponse
The cheap, pollable view of a node - cache sizes per tier plus JVM heap, CPU and uptime.The fallback is the point
The console upgrades independently of the fleet, in either order, so this has to work against a node that has never heard ofget-node-stats. Such a node answers an unrecognized action with a PING response rather than an error, which would otherwise render as a panel of dashes with nothing in any log. Detecting the ping and retrying withget-cache-stategets the one number an older node does have - the entry count - and leaves the restUNKNOWNso the console can show it as "not reported" instead of zero. Same shape asgetResilienceConfigActionResponse(), which does this for the 2.7 rename.- Returns:
- the node's stats, or null when the edge could not be reached at all
-
getCachedKeys
Writes keys to provided output stream- Parameters:
os-- Returns:
-
dumpKeys
Triggers dumping of cached keys to a file on the edge (./warmer dir).- Returns:
- DumpKeysActionResponse with the status message, or null if the edge is not available
-
getFallbackConfigsActionResponse
- Returns:
-
getFallbackEntries
- Returns:
- the fallback entries this edge has loaded, or null when the edge could not be reached
-
getFallbackConfigs
Deprecated.pre-2.7 shape: a single-entry map keyed by domain. UsegetFallbackEntries(). -
getBotsActionResponse
- Returns:
-
getBotKeywords
-
getBotRules
- Returns:
- the bot classification rules this edge is running, in evaluation order and with their
hit counts, or null when the edge could not be reached OR is older than 2.9.0 (which
knows only
getBotKeywords())
-
getBots
Deprecated.pre-2.7 shape: a single-entry map keyed by domain. UsegetBotKeywords(). -
getDynamicURLsActionResponse
- Returns:
-
getDynamicUrlPatterns
-
getDynamicURLs
Deprecated.pre-2.7 shape: a single-entry map keyed by domain. UsegetDynamicUrlPatterns(). -
getFallbacksConfigActionResponse
The raw conf/fallbacks.conf of this edge - what the console's Fallback Config screen renders. The parsed counterpart isgetFallbackEntries(); note the two action names are one letter apart, seeFrontcacheAction.GET_FALLBACKS_CONFIG.- Returns:
- the response, which carries either the file or a "not found" error; null if the edge could not be reached at all
-
getFallbacksConfig
-
getDynamicURLsConfigActionResponse
The raw conf/dynamic-urls.conf of this edge - what the console's Dynamic URLs screen renders. The parsed counterpart isgetDynamicURLsActionResponse().- Returns:
- the response, which carries either the file or a "not found" error; null if the edge could not be reached at all
-
getDynamicURLsConfig
-
getBotsConfigActionResponse
The raw conf/bots.conf of this edge - what the console's Bot Configs screen renders. The parsed counterpart isgetBotsActionResponse().- Returns:
- the response, which carries either the file or a "not found" error; null if the edge could not be reached at all
-
getBotsConfig
-
getGuardRulesActionResponse
- Returns:
- guard rules this edge is running, in evaluation order, with hit counts
-
getGuardRules
-
getGuardConfigActionResponse
- Returns:
-
getGuardConfig
-
getResilienceConfigActionResponse
Asks for the raw resilience config, falling back to the pre-2.7 action name when the edge does not recognize the current one. The fallback is needed because an unknown action is not an error on the wire: the management servlet answers it with a ping response, which would render the console's panel empty with nothing in any log to explain why. A ping is therefore the signal to retry with the old name - a precise test, since this client never sendspingitself.- Returns:
- the response, or null when the edge could not be reached
-
getResilienceConfig
- Returns:
- the raw contents of the edge's conf/resilience.properties, or null when the edge could not be reached
-
getConfigFile
The raw content of any of the five editable config files, by logical id. Dispatches to the per-file getters rather than replacing them: each one carries its own wire-format compatibility (the resilience getter retries with the pre-2.7 action name, the others read a field an older node may not send), and folding that into one call would drop it.- Returns:
- the file's content, null when the edge could not be reached or has no such file
-
setConfig
public SetConfigActionResponse setConfig(ConfigFile configFile, String content, String baseHash, boolean apply) Writes one config file on the edge and applies it.A ping means the node predates this action
An unrecognized action is answered with a ping, not an error, so without this check a save to an older node would parse into a response withresponseStatus=OKandwritten=false- i.e. the console would report a success that never happened. That is the worst outcome available here, and a mixed fleet is the normal state: the console upgrades independently of the nodes, in either order.- Parameters:
baseHash- sha-256 of the content being replaced, or null to skip the concurrency check- Returns:
- the outcome, or null when the edge could not be reached at all
-
getWarmerStatus
-
getWarmerLists
-
getWarmerList
- Parameters:
grep- a search, or null
-
downloadWarmerList
Streams a whole list intoos(raw=true) - never through memory, so a 64 MB list can pass through the console to a browser.- Returns:
- null on success, otherwise why not
-
putWarmerList
public WarmerListActionResponse putWarmerList(String name, InputStream body, long length, String baseHash) Creates or replaces a list. The list goes as the request BODY, with the parameters in the query string: Jetty refuses a form body over 200,000 bytes (on the console's container and the node's), and a list will reach that - the config files never have.- Parameters:
length- the body's length, or -1 to send it chunkedbaseHash- the hash the list had when it was read, or null to skip the concurrency check
-
deleteWarmerList
-
warmerPreflight
-
warmerStart
-
warmerUpdate
A null leaves that setting as it is. -
warmerPause
-
warmerResume
-
warmerStop
-
reloadResilience
Reloads the edge's conf/resilience.properties.- Returns:
- the outcome -
getWarnings()carries what could not be applied - or null when the edge could not be reached
-
reloadDynamicURLs
Reloads the edge's conf/dynamic-urls.conf.- Returns:
- the outcome -
getPatternCount()is how many patterns survived the parse - or null when the edge could not be reached
-
getHystrixConfigActionResponse
Deprecated.pre-2.7 name ofgetResilienceConfigActionResponse() -
getHystrixConfig
Deprecated.pre-2.7 name ofgetResilienceConfig() -
getFromCacheActionResponse
- Returns:
-
getFromCache
-
putToCache
Pushes a WebResponse entry into the remote node's cache. Used by the replication engine to write entries from a source edge to a target edge.- Parameters:
key- the cache key (normalised path)webResponse- the entry to store- Returns:
- true if the entry was stored successfully
-
getCachedKeysSet
-
getFrontCacheURL
-
getName
-
hashCode
-
equals
-
toString
-