Package s3 :: Module s3sync :: Class S3Sync
[frames] | no frames]

Class S3Sync

source code

     object --+    
              |    
s3rest.S3Method --+
                  |
                 S3Sync

Synchronization Handler

Instance Methods
 
__init__(self)
Constructor
source code
 
apply_method(self, r, **attr)
RESTful method handler, responds to: - GET [prefix]/[name]/sync.xml - incoming pull - PUT|POST [prefix]/[name]/sync.xml - incoming push - POST sync/repository/register.json - remote registration
source code
 
synchronize(self, repository)
Synchronize with a repository, called from scheduler task
source code
 
create_archive(self, dataset_id, task_id=None)
Create an archive for a data set
source code
 
config(self)
Lazy access to the current sync config
source code
 
get_status(self)
Read the current sync status
source code
 
set_status(self, **attr)
Update the current sync status
source code

Inherited from s3rest.S3Method: __call__, widget

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

Class Methods
 
onconflict(cls, item, repository, resource)
Automatic conflict resolution
source code
Static Methods
 
get_filters(task_id)
Get all filters for a synchronization task
source code

Inherited from s3rest.S3Method: crud_string

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

Constructor

Overrides: object.__init__

apply_method(self, r, **attr)

source code 

RESTful method handler, responds to:
    - GET [prefix]/[name]/sync.xml          - incoming pull
    - PUT|POST [prefix]/[name]/sync.xml     - incoming push
    - POST sync/repository/register.json    - remote registration

NB incoming pull/push reponse normally by local sync/sync
   controller as resource proxy => back-end generated S3Request

@param r: the S3Request
@param attr: controller parameters for the request

Parameters:
  • r - the S3Request
  • attr - dictionary of parameters for the method handler
Returns:
output object to send to the view
Overrides: s3rest.S3Method.apply_method

synchronize(self, repository)

source code 

Synchronize with a repository, called from scheduler task

Parameters:
  • repository - the repository Row
Returns:
True if successful, False if there was an error

onconflict(cls, item, repository, resource)
Class Method

source code 

Automatic conflict resolution

Parameters:
  • item - the conflicting import item
  • repository - the repository the item comes from
  • resource - the resource the item shall be imported to

create_archive(self, dataset_id, task_id=None)

source code 

Create an archive for a data set

Parameters:
  • dataset_id - the data set record ID
  • task_id - the scheduler task ID if the archive is created asynchronously
Returns:
error message if an error occured, otherwise None

config(self)

source code 

Lazy access to the current sync config

Decorators:
  • @property

get_status(self)

source code 

Read the current sync status

set_status(self, **attr)

source code 

Update the current sync status

get_filters(task_id)
Static Method

source code 

Get all filters for a synchronization task

Parameters:
  • task_id - the task ID
Returns:
a dict of dicts like {tablename: {url_var: value}}