Conversation
|
No tests for now. If the approach is ok for you in general, I can add tests and a |
txn.go
Outdated
| idSchema := tableSchema.Indexes[id] | ||
| ok, idVal, err := idSchema.Indexer.FromObject(obj) | ||
| idIndexer, ok := idSchema.Indexer.(SingleIndexer) | ||
| if !ok { |
There was a problem hiding this comment.
I would push this check into the Validate of the schema, just so it can be avoided here
|
@floridoo I like the implementation, its moving the right way, left some feedback on cleanups for it! |
b3f4803 to
608dda3
Compare
|
@armon Updated and rebased the pull request, added |
|
@floridoo works great for my usecase, thanks! |
|
@armon do you plan to merge this anytime soon ? :) |
|
Hey @armon, any way to move this forward? We temporarily switched to @floridoo's fork (moby/swarmkit#1728) to use this feature but we'd very much prefer to move back to mainline. This feature allows us to handle many to many relationships and without it we had to resort to a very costly linear scan. This is our use case, maybe there's a better way to do this: a container can reference multiple networks and a network can be referenced by multiple containers. When removing a network, we want to figure out if any container is referencing it (sanity check to avoid dangling references). With multi index, we can simply create a container indexer that returns all network IDs the container is referencing. When deleting a network, we just lookup the container table by network ID. Without it, we have to scan all containers (there can be a ton) and manually check if they reference the network. |
|
Hey @floridoo sorry for the delay on this one - it got buried under some things. I'll review this week. |
|
Thanks @floridoo - finally had some time to review and close this out! |
See #15