Data Model¶
This section serves to describe the relationships between the various components in an Artifact. It seeks to present an explicit set of named resource types and how they relate to one another.
This data model seeks to identify explicitly any implicit relationships and to add semantic color to these. It is a work in progress and likely to be incomplete and/or wrong.
Projects and Named Resources¶
Certain resources are named, meaning that these entities may be referenced by user-defined semantic identifiers. Since Truffle targets the full development lifecycle, this means names refer to different things at different times.
Contracts and Networks, for example, both use names. These resources represent entities that change over time. Contracts are written, rewritten, and/or updated many times between a project’s start and past its production deployment. Development networks reset, and public networks fork.
To represent these entities across the entire project lifecycle, Truffle DB models names as a linked list of references to immutable entities.
Each Named resource contains the non-nullable string attribute name
, used
to index by type.
NameRecord can be considered generically to represent a linked list of
current and past resource name references for a given resource type T
.
Each NameRecord has the same name
, plus the following:
- type
to represent the underlying named resource type
- resource
to point to the underlying resource
- previous
to point to the previous name
In order to track the current NameRecords for a given type, the Project resource serves as the aggregation point for the heads of these linked lists.
Data Model Resources¶
Contracts, Constructors, and Instances¶
Sources, Bytecodes, and Compilations¶
Contract Interfaces¶
Contract Interfaces have not been implemented in the first version of Truffle DB, but will be added in a future iteration.
Combined Data Model¶