DataDirectory
The Data Directory is used to manage what data exists on the network. As such,
it contains a complete list of all accessible content; each file uploaded to
any storage node requires an entry in the data directory, in the form of a
DataObject
. These DataObjects
are identified via a unique DataObjectId
.
It also links to the Data Object Type Registry, permitting all participating apps (consuming apps or storage node) to negotiate whether content may be uploaded.
The simplified workflow for uploading content is as follows:
ContentId
. The ContentId
is a secure random Byte string,
and will usually be represented in a Base58
encoded form.DataObjectType
from the Data Object Type Registry.DataObjectType
.DataObject
linking to the selected DataObjectType
. The
DataObject
is not initially active.DataObjectType
. The Liaison will update the DataObject
according to its decision.Any storage provider listed in the Data Object Storage Registry as holding a given file can be contacted for downloads.
While the above describes the abstract protocol for up- and downloads, the specific wire protocol are HTTP requests conforming to the most-current OpenAPI specification of the storage node.
It is generated from code documentation, so not easily linked here. The API
version is currently not stable, so a v0
namespace is specified. The most
current API specs live
on Joystream's first storage node.
Note that DataObject
contains a storage_metadata
and corresponding
storage_metadata_version
object. The version determines how to interpret the
metadata field. They are maintained by the Liaison (and potentially other
storage providers) for managing storage backend specific metadata.
In version 1
of this metadata, it is expected that:
ipfs_content_id
field specifying a content ID to map
to when using IPFS as the backend.The runtime is responsible for selecting a Liaison for a DataObject
. The
Liaison is selected from the currently staked pool of storage providers from
any of the tranches configured in the Staking part of this
module, for matching DataObjectType
.
The implication of this is that between creating a DataObject
and uploading
data to the Liaison, not too much time should pass. If there is a reason for
the Liaison to un-stake before re-distributing the content, then the
DataObject
cannot be uploaded, and a new DataObject
needs to be created.
DataObjects
- a map of ContentId
to DataObject
.DataObjectAdded
- a new DataObject
has been created, with Pending
liaison judgement. See above for a high-level description of how
a Liaison will judge whether a DataObject
is acceptable.The event payload consists of the ContentId
and the uploader's
AccountId
.
DataObjectAccepted
- the chosen Liaison accepted the data object.The event payload consists of the ContentId
and the Liaison
AccountId
.
DataObjectRejected
- the chosen Liaison rejected the data object.The event payload consists of the ContentId
and the Liaison
AccountId
.
add_data_object
content_id
: The ContentId
chosen by the uploader.type_id
: The DataObjectTypeId
chosen by the uploader.size
: The file size, in Bytes.As one of the first steps of the upload process, the uploader will call
this function to register their intent to upload data. This also registers
the ContentId
, making it unavailable for further upload attempts.
As part of this function, the runtime will chose an appropriate Liaison,
and record it in the DataObject
.
ContentId
is already in use.DataObjectType
is inactive.DataObject
with the given size and type is created, and registered
under the ContentId
in DataObjects
.DataObjectAdded
accept_data_object
content_id
: The ContentId
of the DataObject
to accept.The Liaison calls this function when its checks indicate that the DataObject
should be accepted.
ContentId
was not found.DataObject
.DataObject
identified by ContentId
has their liaison_judgement
field
set to Accepted.DataObjectAccepted
reject_data_object
content_id
: The ContentId
of the DataObject
to reject.The Liaison calls this function when its checks indicate that the DataObject
should be rejected.
ContentId
was not found.DataObject
.DataObject
identified by ContentId
has their liaison_judgement
field
set to Rejected.DataObjectRejected