This topic describes the data type in OSS Connector for AI/ML.
Data type
The DataObject data type in OSS Connector for AI/ML supports only the write-only or the read-only mode. The read-only mode supports sequential read and random read. The write-only mode supports only sequential write.
Example:
class DataObject:
key: str
size: int
label: str
def __enter__(self) -> DataObject: ...
def __exit__(self, exc_type, exc_val, exc_tb): ...
def tell(self) -> int: ...
def seek(self, offset: int, whence: int) -> int: ...
def read(self, count: int) -> bytes: ...
def readinto(self, buf) -> int: ...
def write(self, data) -> int: ...
def close(self) -> int: ...
def copy(self) -> DataObject: ...
Methods
DataObject supports common I/O methods. The following table describes the I/O methods.
Method | Type/Return value type | Description |
|
| The unique identifier of the object. |
|
| The actual size of the object. Unit: bytes. |
|
| The tags of the object, which are used for classification or labeling. |
|
| The method that is used to go to the context manager to initialize the |
|
| The method that is used to exit the context manager to release resources or perform cleanup operations. |
|
| Obtains the position of the current file pointer in read-only mode. Unit: bytes. |
|
| Specifies the position of the file pointer in read-only mode. Unit: bytes. |
|
| Reads the specified number of bytes starting from the position of the current file pointer in read-only mode. Unit: |
|
| Reads data starting from the position of the current file pointer to the buffer in read-only mode, and returns the actual number of bytes that are read. |
|
| Writes data to the position of the current file pointer in write-only mode and returns the number of bytes that are written. |
|
| Closes the file and releases the related resources. |
|
| Creates a new |