Skip to content

data_model.py

ofrak.model.data_model

DataModel dataclass

Representation of a chunk of binary data stored in a DataServiceInterface implementation.

Attributes:

Name Type Description
id bytes

Unique ID for this data model.

range Range

The slice of some underlying binary blob which belongs to this data model. For root models, this range starts from 0 and ends at the total length of the blob.

root_id bytes

If this model represents a part of a root model's data, this is the ID of that root data model.

DataPatch dataclass

Representation of a binary patch to part of a resource's data.

Attributes:

Name Type Description
range Range

The slice of the binary blob to replace with new data (zero-length is allowed)

data_id bytes

ID of the binary blob to apply this path to

data bytes

The bytes to replace old data with (zero-length is allowed)

DataPatchesResult dataclass

Summary of changes to a binary blob resulting from the application of a DataPatch.

Attributes:

Name Type Description
data_id bytes

ID of the patched blob

patches List[ofrak_type.range.Range]

Range in the original blob which have been altered by applying patches