Package fcp :: Module sitemgr :: Class SiteState
[hide private]
[frames] | no frames]

Class SiteState

source code

Stores the current state of a single freesite's insertion, in a way that can recover from cancellations, node crashes etc

The state is saved as a pretty-printed python dict, in ~/.freesitemgr/<sitename>

Instance Methods [hide private]
 
__init__(self, **kw)
Create a sitemgr object
source code
 
load(self)
Attempt to load a freesite
source code
 
create(self)
Creates initial site config
source code
 
save(self)
Saves the node state
source code
 
getFile(self, name)
returns the control record for file 'name'
source code
 
cancelUpdate(self)
Cancels an insert that was happening
source code
 
insert(self)
Performs insertion of this site, or gets as far as we can, saving along the way so we can later resume
source code
 
cleanup(self)
Cleans up node queue in respect of currently-inserting freesite, removing completed queue items and updating our local records
source code
 
managePendingInsert(self)
Check on the status of the currently running insert
source code
 
scan(self)
Scans all files in the site's filesystem directory, marking the ones which need updating or new inserting
source code
 
clearNodeQueue(self)
remove all node queue records relating to this site
source code
 
readNodeQueue(self)
Refreshes the node global queue, and reads from the queue a dict of all jobs which are related to this freesite
source code
 
createIndexAndSitemapIfNeeded(self)
generate and insert an index.html if none exists
source code
 
allocId(self, name)
Allocates a unique ID for a given file
source code
 
markManifestFiles(self)
Selects the files which should directly be put in the manifest and marks them with rec['target'] = 'manifest'.
source code
 
makeManifest(self)
Create a site manifest insertion command buffer from our current inventory
source code
 
fallbackLogger(self, level, msg)
This logger is used if no node FCP port is available
source code
Method Details [hide private]

__init__(self, **kw)
(Constructor)

source code 

Create a sitemgr object

Keywords:

  • sitemgr - a SiteMgr object, mandatory
  • basedir - directory where sitemgr files are stored, default is ~/.freesitemgr
  • name - name of freesite - mandatory
  • dir - directory of site on filesystem, mandatory

If freesite doesn't exist, then a new state file will be created, from the optional keywords 'uriPub' and 'uriPriv'

readNodeQueue(self)

source code 

Refreshes the node global queue, and reads from the queue a dict of all jobs which are related to this freesite

Keys in the dict are filenames (rel paths), or __manifest

markManifestFiles(self)

source code 

Selects the files which should directly be put in the manifest and marks them with rec['target'] = 'manifest'. All other files are marked with 'separate'.