Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify DB Schema: add tables for delivery channels #618

Closed
tomcrane opened this issue Sep 20, 2023 · 5 comments · Fixed by #710
Closed

Modify DB Schema: add tables for delivery channels #618

tomcrane opened this issue Sep 20, 2023 · 5 comments · Fixed by #710

Comments

@tomcrane
Copy link
Contributor

tomcrane commented Sep 20, 2023

  • Add a new table to store per-channel policies (DeliveryChannelPolicies).
  • Add a new joining table (ImageDeliveryChannels)

An asset can have [0..n] delivery channels with the fields channel and policy.

  • channel is the string iiif-img|thumbs|iiif-av|file
  • policy is a reference to either a system policy (e.g., use-original), or to a DeliveryChannelPolicy that belongs to the customer, which appears in the API as a URI but in the DB is some referential link.

A customer or a Space can have [0..n] delivery channels with the fields channel, policy and mediaType. These are matched on mediaType to assets when assigned by the default mechanism and new per-asset delivery channels created. They are templates for the asset delivery channels above.

So we have template DeliveryChannelPolicy objects that get copied and given to new customers as their own set of DeliveryChannelPolicy objects that they can reference, and tweak.

We have template DeliveryChannel objects that a Customer or Space has as members of defaultDeliveryChannels - we assign a selection to customer.defaultDeliveryChannels on customer creation, they reference the copied DeliveryChannelPolicy objects above (or "globals" like use-original). These are only used by the default matching process to populate an Asset's delivery channels when the API caller doesn't specify any.

And we have the "real" DeliveryChannel objects that belong to an asset, either specified explicitly by the API caller, or assigned through default logic by matching one of the above template DeliveryChannel objects, and copying it.

Do we have enough tables?

@tomcrane
Copy link
Contributor Author

@tomcrane
Copy link
Contributor Author

Acceptance criteria

  1. A schema for the tables (design suggestion - can be put here)
  2. Agree that those tables (probably 2) can store what is required by the docs
  3. Add those tables to the DB
  4. Add EF domain objects to the context

@JackLewis-digirati
Copy link
Contributor

JackLewis-digirati commented Jan 16, 2024

started an rfc here for the database design - https://github.com/dlcs/private-protagonist/blob/feature/deliveryChannelDatabase/docs/rfcs/012-delivery-channels-database.md

  • A schema for the tables (design suggestion - can be put here)
  • Agree that those tables (probably 2) can store what is required by the docs
  • Add EF domain objects to the context
  • Add those tables to the DB

@tomcrane
Copy link
Contributor Author

tomcrane commented Jan 23, 2024

WIP possible tables

link between asset and its deliverychannels+policies

ImageDeliveryChannels

ImageId
DeliveryChannelPolicyId
channel

policies+DCs available to my assets

DeliveryChannelPolicy

id
channel ("image")
name ("standard", "my-thumbs", "default")
displayName
channel ("image")
mediaType ("image/", "image/jp2")
policyData (["none"], ["video-mp4-720p"], ["use-original"])
system

customer (0, 37)

*If an asset has this property = true (needs better name), then:

  • Customers don't get their own copies
  • The API emits it using just the name not a fully qualified URI

For allocating defaults on incoming API payloads that lack any dc info and don't explicitly say "channel": "none"

DefaultDeliveryChannelPolicies

DeliveryChannelPolicyId
customer (37 --
space (0, 99, 123)
mediaType?

@tomcrane
Copy link
Contributor Author

tomcrane commented Jan 23, 2024

Donald comments:

I think these are the questions:

API

  • If deliveryChannels specified:
    • how are these saved? where do we save in db?
  • If deliveryChannels not specified
    • how do we identify what policies/channels to use?
    • how are these saved? where do we save in db?
  • When asset requested - how is the Hydra model populated?

Engine (by the time it picks up API will have done it's thing + record will be populated)

  • How does engine identify which workers to invoke (file/image/av)
  • How does each worker know what to do (which thumbs, what transcode targets etc)

Orchestrator

  • When a request is received, how does Orchestrator determine if asset is available on that channel (this should be as efficient as poss)

that bottom table (DefaultDeliveryChannelPolicies) is a replacement for

"IngestDefaults": {
"StoragePolicy": "default",
"FamilyDefaults": {
"I": {
"OptimisationPolicy": {
"*": "fast-higher"
},
"DeliveryChannel": "iiif-img",
"ThumbnailPolicy": {
"*": "default"
}
},
"T": {
"OptimisationPolicy": {
"audio": "audio-max",
"video": "video-max"
},
"DeliveryChannel": "iiif-av"
},
"F": {
"OptimisationPolicy": {
"*": "none"
},
"DeliveryChannel": "file"
}
}
}
},

See #625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants