iotcs.client.device.storage module¶
-
class
iotcs.client.device.storage.StorageObjectBase(delegate)¶ Bases:
iotcs.client.client.StorageObjectA base call for storage object implementations.
Create a StorageObjectBase instance.
-
class
SyncEventImpl(source, virtualDevice, name)¶ Bases:
iotcs.client.client.SyncEventAn event passed to the
setOnSync()SyncCallback.This event occurs when an attribute value’s content refers to a
StorageObjectand has been successfully synchronized, or has failed to be synchronized.Create a SyncEventImpl instance.
-
getName()¶ Return the name of the attribute, action, or format.
Return the name of the attribute, action, or format that this event is associated with.
Returns: the name, or None if sync()was called independently
-
getSource()¶ Return the
StorageObjectsource of this event.:return the storageObject, never None
-
-
addSyncEvent(syncEvent)¶ Add syncEvent to syncEvents.
If syncCallback is None do nothing.
-
delegate¶
-
eventLock¶
-
getDelegate()¶ Return delegate.
Returns: delegate
-
getSyncEvents()¶ Return syncEvents.
Returns: syncEvents
-
handleStateChange()¶ Perform necessary tasks when the state changes.
-
setOnSync(callback)¶ Set a
StorageObject.SyncCallback.The callback is invoked when the content referred to by this
StorageObjectis synchronized.Parameters: callback – a StorageObject.SyncCallbackto invoke when there is an error setting a value, if None, the existing syncCallback is removed.
-
sync()¶ Notify the library to sync content with the storage cloud.
The direction of the sync, upload or download, depends on whether
inputPathor theoutputPathhave been set. This method does not start any uploads or downloads ifsycn statusis other thanNOT_IN_SYNC.This is a non-blocking call. The sync is performed on a separate thread on this
StorageObject.If the input path cannot be read, or the output path cannot be written, an OSError is raised. Any I/O exceptions during the background sync are reported through the virtual device
error callbackof the virtual device.Raises: ValueError – if both input path and output path are None
-
syncEvents¶
-
class
-
class
iotcs.client.device.storage.StorageObjectImpl(directlyConnectedDevice, delegate)¶ Bases:
iotcs.client.device.storage.StorageObjectBaseAn implementation of
StorageObjectBase.Create a StorageObjectImpl instance.
Parameters: - directlyConnectedDevice – the
messaging.client.device.DirectlyConnectedDevicewithmessaging.client.StorageObjectattributes. - delegate – the
messaging.client.StorageObjectto handle storage operations.
-
deviceForSyncEvent¶
-
handleStateChange()¶ Handle changes in sync status.
-
nameForSyncEvent¶
-
setSyncEventInfo(virtualDevice, nameForSyncEvent)¶ Set the virtual device and name for a sync event.
Parameters: - virtualDevice – a
VirtualDeviceinstance - nameForSyncEvent – a name for a sync event
Returns: - virtualDevice – a
-
storageDispatcher¶
-
sync()¶ Synchronize the content with storage cloud service.
- directlyConnectedDevice – the