Package s3 :: Package sync_adapter :: Module adashi :: Class S3SyncAdapter
[frames] | no frames]

Class S3SyncAdapter

source code

              object --+    
                       |    
s3sync.S3SyncBaseAdapter --+
                           |
                          S3SyncAdapter

ADASHI Synchronization Adapter (passive)

http://www.adashisystems.com

Instance Methods
 
register(self)
Register this site at the peer repository
source code
 
login(self)
Login at the peer repository
source code
 
pull(self, task, onconflict=None)
Outgoing pull
source code
 
push(self, task)
Outgoing push
source code
 
send(self, resource, start=None, limit=None, msince=None, filters=None, mixed=False, pretty_print=False)
Respond to an incoming pull from a peer repository
source code
 
receive(self, source, resource, strategy=None, update_policy=None, conflict_policy=None, onconflict=None, last_sync=None, mixed=False)
Respond to an incoming push from the peer repository
source code
 
update_assignments(self, item)
Deactivate all previous unit assignments (event_team) for an incident which are not in this feed update.
source code
 
keep_source(self, tree, category)
Helper method to store source data in file system
source code

Inherited from s3sync.S3SyncBaseAdapter: __init__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

register(self)

source code 

Register this site at the peer repository

Returns:
True to indicate success, otherwise False
Overrides: s3sync.S3SyncBaseAdapter.register

login(self)

source code 

Login at the peer repository

Returns:
None if successful, otherwise the error
Overrides: s3sync.S3SyncBaseAdapter.login

pull(self, task, onconflict=None)

source code 

Outgoing pull

Parameters:
  • task - the task (sync_task Row)
Returns:
tuple (error, mtime), with error=None if successful, else error=message, and mtime=modification timestamp of the youngest record sent
Overrides: s3sync.S3SyncBaseAdapter.pull

push(self, task)

source code 

Outgoing push

Parameters:
  • task - the sync_task Row
Returns:
tuple (error, mtime), with error=None if successful, else error=message, and mtime=modification timestamp of the youngest record sent
Overrides: s3sync.S3SyncBaseAdapter.push

send(self, resource, start=None, limit=None, msince=None, filters=None, mixed=False, pretty_print=False)

source code 

Respond to an incoming pull from a peer repository

Parameters:
  • resource - the resource to be synchronized
  • start - index of the first record to send
  • limit - maximum number of records to send
  • msince - minimum modification date/time for records to send
  • filters - URL filters for record extraction
  • mixed - negotiate resource with peer (disregard resource)
  • pretty_print - make the output human-readable
Returns:
a dict {status, remote, message, response}, with:
  • status....the outcome of the operation
  • remote....whether the error was remote (or local)
  • message...the log message
  • response..the response to send to the peer
Overrides: s3sync.S3SyncBaseAdapter.send

receive(self, source, resource, strategy=None, update_policy=None, conflict_policy=None, onconflict=None, last_sync=None, mixed=False)

source code 

Respond to an incoming push from the peer repository

Parameters:
  • source - the input stream (list of file-like objects)
  • resource - the target resource
  • strategy - the import strategy
  • update_policy - the update policy
  • conflict_policy - the conflict resolution policy
  • onconflict - callback for conflict resolution
  • last_sync - the last synchronization date/time for the peer
  • mixed - negotiate resource with peer (disregard resource)
Returns:
a dict {status, remote, message, response}, with:
  • status....the outcome of the operation
  • remote....whether the error was remote (or local)
  • message...the log message
  • response..the response to send to the peer
Overrides: s3sync.S3SyncBaseAdapter.receive

update_assignments(self, item)

source code 

Deactivate all previous unit assignments (event_team) for an incident which are not in this feed update.

Parameters:
  • item - the import item
Notes:
  • this assumes that the list of incident resources in the feed update is complete (confirmed for ADASHI)
  • must not deactivate assignments which are newer than the feed update (Sync policy NEWER)

keep_source(self, tree, category)

source code 

Helper method to store source data in file system

Parameters:
  • tree - the XML element tree of the source
  • category - the feed category