-
Notifications
You must be signed in to change notification settings - Fork 1
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
Cache virtual object membership #586
base: main
Are you sure you want to change the base?
Conversation
5dc768a
to
1f0c931
Compare
spec/factories/purl.rb
Outdated
@@ -1,7 +1,7 @@ | |||
FactoryBot.define do | |||
factory :purl do | |||
sequence :druid do |n| | |||
"druid:zz#{n.to_s * 3}yy#{n.to_s * 4}" | |||
"druid:zz#{"%03d" % rand(1000)}yy#{"%04d" % rand(10000)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sequence approach stopped working when we had more than 10 uses of this factory.
1f0c931
to
bcc7512
Compare
I think I don't understand this architecturally. Maintaining a parallel database of COCINA-derived data seems unfortunate. It still feels like SDR could send us everything we need to know up-front? |
And, not just unfortunate, but doesn't this rely on us maintaining an accurate database? Async or parallel operations seem like we could get some inconsistent behavior. It feels like it'd be nicer if infra maintained the only source of truth and hand over all the data we need in their original request. |
They do hand over all the data. We just need a way to look at this relationship inversely, just the same as we do with collection membership. This is just a cache of the data. |
bcc7512
to
892530d
Compare
This is required for adding relatedItem entries on the public xml. Fixes #585
892530d
to
6256f2a
Compare
Maybe I don't understand what we're planning to use this data for. It seems to me, if it's data we need internally to construct the public xml, SDR should provide that to us to avoid any hint of race conditions, non-idempotent behavior, or need for synchronous processing. |
@cbeer it will be used to construct the virtual object relationships (e.g. At present the infrastructure team is looking this up in the Argo solr (which they are trying to decouple from). |
The difference with the collection membership data is that we're not trying to consume that synchronously. Without infra handing us the data, won't we need to process a virtual object and the constituents in a well-defined order (make sure we've processed all the constituents before the virtual object?) or have some logic to update the virtual object whenever a constituent changes? That seems like at least as much of a pain. I guess I don't know enough about how the Cocina is managed on the infra side; I guess I assumed there was just a big database they could ask? |
This is required for adding relatedItem entries on the public xml. Fixes #585