Interface¶
- class datalake.interface.IMonitor[source]¶
The monitoring abstract class defines methods for sending metrics to a Time Series Database
- abstract push(measurement)[source]¶
Sends a measurement to the TSDB backend
- Parameters
measurement (Measurement) – the measurement to send
- class datalake.interface.ISecret[source]¶
The secret interface defines methods for fetching a cloud managed secret
- abstract property json¶
Returns the secret as a
dict
- abstract property plain¶
Returns the secret in plain UTF-8 text
- class datalake.interface.IStorage[source]¶
The storage interface defines method for manipulating files in a cloud object/blob storage
- abstract checksum(key)[source]¶
Returns the SHA256 hash for the file at the specified path
- Parameters
key (str) – the path of a storage object
- abstract copy(src, dst, bucket=None)[source]¶
Copies a storage key to another key in the same storage or another
- Parameters
src (str) – the path of a storage object to copy
dst (str) – the path of the target storage object
bucket (str) – if specified then the object is copied in this bucket. If
Nonethe object is copied in the same bucket than the source object
- abstract delete(key)[source]¶
Removes an object from the storage
- Parameters
key (str) – the path of a storage object
- abstract download(src, dst)[source]¶
Downloads a storage file locally
- Parameters
src (str) – the path of a storage object
dst (str) – the path of the target local file
- abstract exists(key)[source]¶
Returns
Trueif the specified key exists,Falseotherwise- Parameters
key (str) – the path of a storage object
- abstract get(key)[source]¶
Returns the content of the specified object
- Parameters
key (str) – the path of a storage object
- abstract is_folder(key)[source]¶
Return
Trueif the specified key is a folder-like object,Falseotherwise- Parameters
key (str) – the path of a storage object
- abstract keys_iterator(prefix)[source]¶
Returns an iterator of keys that match the specified prefix
- Parameters
prefix (str) – a partial path of a storage object
- abstract move(src, dst, bucket=None)[source]¶
Moves a storage key to another key in the same storage or another
- Parameters
src (str) – the path of a storage object to move
dst (str) – the path of the target storage object
bucket (str) – if specified then the object is moved in this bucket. If
Nonethe object is moved in the same bucket than the source object
- abstract property name¶
Returns the name of the storage
- abstract put(content, dst, content_type='text/csv', encoding='utf-8', metadata={})[source]¶
Writes the specified content in a storage object
- Parameters
content (str) – the content to upload
dst (str) – the path of the target storage object
content_type (str) – the MIME type for the file
encoding (str) – the encoding for the file
metadata (dict) – a map of key/value pairs to add as metadata for the uploaded file
- abstract size(key)[source]¶
Return the size in bytes for the specified object
- Parameters
key (str) – the path of a storage object
- abstract stream(key, encoding='utf-8')[source]¶
Returns an iterator on each lines for the specified object
- Parameters
key (str) – the path of a storage object
encoding (str) – the encoding to use for decoding the byte stream
- abstract upload(src, dst, content_type='text/csv', encoding='utf-8', metadata={})[source]¶
Uploads a local file to the storage
- Parameters
src (str) – the path of a local file
dst (str) – the path of the target storage object
content_type (str) – the MIME type for the file
encoding (str) – the encoding for the file
metadata (dict) – a map of key/value pairs to add as metadata for the uploaded file