iotcs.client.device.storage module¶
-
class
iotcs.client.device.storage.
StorageObjectBase
(delegate)¶ Bases:
iotcs.client.client.StorageObject
A base call for storage object implementations.
Create a StorageObjectBase instance.
-
class
SyncEventImpl
(source, virtualDevice, name)¶ Bases:
iotcs.client.client.SyncEvent
An event passed to the
setOnSync()
SyncCallback
.This event occurs when an attribute value’s content refers to a
StorageObject
and 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
StorageObject
source 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
StorageObject
is synchronized.Parameters: callback – a StorageObject.SyncCallback
to 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
inputPath
or theoutputPath
have been set. This method does not start any uploads or downloads ifsycn status
is 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 callback
of 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.StorageObjectBase
An implementation of
StorageObjectBase
.Create a StorageObjectImpl instance.
Parameters: - directlyConnectedDevice – the
messaging.client.device.DirectlyConnectedDevice
withmessaging.client.StorageObject
attributes. - delegate – the
messaging.client.StorageObject
to 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
VirtualDevice
instance - nameForSyncEvent – a name for a sync event
Returns: - virtualDevice – a
-
storageDispatcher
¶
-
sync
()¶ Synchronize the content with storage cloud service.
- directlyConnectedDevice – the