AmbireTech / adex-validator-stack-rust

The Ambire AdEx Validator Stack implemented in Rust: sentry, validator worker, adapter, adview manager
https://adex.network
GNU Affero General Public License v3.0
11 stars 10 forks source link

Supermarket's `units-for-slot` route integration inside Sentry #471

Closed elpiel closed 2 years ago

elpiel commented 2 years ago

Move Supermarket's GET /units-for-slot to sentry

The market will be fully integrated into the platform and the units-for-slot route will be moved to Sentry.

AdSlot will not be persisted in the database, instead, the whole AdSlot will be used in the adview-manager to generate the ad view code.

Initially for an active status of the Campaign simply use:

Check out the platform issue for more details https://github.com/AmbireTech/adex-platform/issues/625

elpiel commented 2 years ago

Here's a non-exhaustive list of the identified changes required to move and alter the /units-for-slot route to account for the V5 changes:

elpiel commented 2 years ago

Supermarket statuses to V5

The statuses of campaigns/channels (in V4) is computed when they are collected from sentry, before they are put into the cache. Supermarket statuses, in order of the performed checks, linked to their V5 counter parts (if such exist):

:x: - No counterpart in V5 :question: - uncertain if such counterpart exists in V5

  1. Is Finalized? 1.1. Is Channel expired? Utc::now() > channel.valid_until => Is Campaign active Utc::now() > campaign.active.to 1.2. :x: Is in withdraw period? Utc::now() > channel.spec.withdraw_period_start 1.3 Is channel exhausted? total_balances >= channel.deposit_amount => Has remaining budget (in Campaign)?

  2. Is (Channel) initializing?

  3. Is (Channel) Unsound? 3.1. Is (Channel) offline? 3.2. Is (Channel) disconnected? 3.3. Is rejected state (of Channel)? 3.4. Is (Channel) healthy?

  4. Is (Channel) Active? (This status incorporates both Active & Ready statuses) 4.1. Is (Channel) Active? 4.2 Is (Channel) Ready? & channel.spec.active_from < Utc::now() => Is (Channel) Ready? & campaign.active.from < Utc::now()

  5. If not Active and all other status checks have passed, then status is Waiting