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

Class S3SyncAdapter

source code

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

Sahana Eden Synchronization Adapter (default sync adapter)

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)
Fetch updates from the peer repository and import them into the local database (active pull)
source code
 
push(self, task)
Extract new updates from the local database and send them to the peer repository (active 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 the 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

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 

Fetch updates from the peer repository and import them into the local database (active pull)

Parameters:
  • task - the synchronization task (sync_task Row)
  • onconflict - callback for automatic conflict resolution
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 

Extract new updates from the local database and send them to the peer repository (active push)

Parameters:
  • task - the synchronization 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.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 the 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