Skip to content

Hummingbird modifications to assets data model and Search Assets and Update Assets endpoints - #82

Draft
rohrerj wants to merge 14 commits into
juagargi:hummingbird-endhostfrom
rohrerj:hummingbird-alternative-asset-data-model
Draft

rohrerj wants to merge 14 commits into
juagargi:hummingbird-endhostfrom
rohrerj:hummingbird-alternative-asset-data-model

Conversation

@rohrerj

@rohrerj rohrerj commented Oct 15, 2026 •

Copy link
Copy Markdown

Previously whenever a part of an asset was bought, the old asset was deleted and a new asset was created with all remaining bandwidth (if any was left), one was created with the same bandwidth that was bought with the validity period to the left, and one with the validity period to the right of the bought asset. This led very fast to a huge number of assets which also made it much more difficult for a client to query and find the assets it actually needed.

With this PR, the database no longer deletes the old asset or creates new assets for the remainders, only intervals mapping to the same asset. That way the users can still buy from the asset using the original ID, even if in the meantime another user came and also bought from the same asset (given there is still enough bandwidth available) and disk consumption for the database is reduced since for all validity intervals we only store (asset_id, starts_at, stops_at and available), instead of the full asset information, since that information is referenced by the asset_id.
The Search Assets endpoint has been modified to allow for different search modes:

  • Full Validity Overlap: only return assets that can offer enough bandwidth for the entire requested validity period
  • Partial Validity Overlap: return all assets that can offer enough bandwidth at least for a subinterval of the requested validity period. A returned asset might contain multiple validity intervals if it can offer the requested bandwidth during multiple not continuous time intervals.

The Update Assets endpoint had to be modified to ensure compatability with the changes above. Since now we no longer create new assets out of the remainders, certain asset modifications are no longer allowed. The changes that are still allowed are:

  • extend validity period of the asset
  • increae bandwidth of the asset
  • reduce time_min_duration
  • increase time_max_duration
  • reduce min_bandwidth
  • increase max_bandwidth
  • modify price

All those changes do not affect already sold parts of the asset.

TODO:

  • Finalize PR

This change is Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant