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

Convert attributor to IFluidDataStoreChannel #22120

Merged
merged 12 commits into from
Aug 16, 2024
Merged

Conversation

jatgarg
Copy link
Contributor

@jatgarg jatgarg commented Aug 5, 2024

Description

Convert attributor to IFluidDataStoreChannel, so that it can have all the capacity of a datastore channel like send/receive ops, summarize etc.
This will be useful for custom attribution support where we will need all this functionality.
Doc link for custom attribution where we will be using this to send/receive ops: https://microsoft-my.sharepoint-df.com/:w:/p/jatgarg/EaqG3AT4CrRHpN_l_vorFf4B35C5W39g8S1VI0_syIzUuQ?e=r5YiBX
Still working on some of the test in this PR but putting out there for review.

@jatgarg jatgarg self-assigned this Aug 5, 2024
Copy link

changeset-bot bot commented Aug 5, 2024

⚠️ No Changeset found

Latest commit: 4cbd397

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jatgarg jatgarg marked this pull request as draft August 5, 2024 17:19
@github-actions github-actions bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: tests Tests to add, test infrastructure improvements, etc dependencies Pull requests that update a dependency file base: main PRs targeted against main branch labels Aug 5, 2024
@github-actions github-actions bot added the area: examples Changes that focus on our examples label Aug 5, 2024
@jatgarg jatgarg closed this Aug 5, 2024
@jatgarg jatgarg reopened this Aug 5, 2024
@jatgarg jatgarg closed this Aug 5, 2024
@jatgarg jatgarg reopened this Aug 5, 2024
@msfluid-bot
Copy link
Collaborator

msfluid-bot commented Aug 5, 2024

@fluid-example/bundle-size-tests: +245 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 457.72 KB 457.76 KB +35 Bytes
azureClient.js 555.04 KB 555.09 KB +49 Bytes
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 258.54 KB 258.55 KB +14 Bytes
fluidFramework.js 406.84 KB 406.85 KB +14 Bytes
loader.js 134.1 KB 134.11 KB +14 Bytes
map.js 42.13 KB 42.14 KB +7 Bytes
matrix.js 146.3 KB 146.31 KB +7 Bytes
odspClient.js 523.18 KB 523.23 KB +49 Bytes
odspDriver.js 97.55 KB 97.57 KB +21 Bytes
odspPrefetchSnapshot.js 42.61 KB 42.62 KB +14 Bytes
sharedString.js 163 KB 163.01 KB +7 Bytes
sharedTree.js 397.35 KB 397.36 KB +7 Bytes
Total Size 3.3 MB 3.3 MB +245 Bytes

Baseline commit: 56989e4

Generated by 🚫 dangerJS against 49c8fc1

@jatgarg jatgarg requested review from a team, pragya91, markfields, tyler-cai-microsoft, kian-thompson and rajatch-ff and removed request for a team August 12, 2024 17:14
@jatgarg jatgarg closed this Aug 13, 2024
@jatgarg jatgarg reopened this Aug 13, 2024
@jatgarg jatgarg marked this pull request as ready for review August 13, 2024 20:35
@@ -4,10 +4,10 @@
*/

export { type IAttributor } from "./attributor.js";
export { mixinAttributor, getRuntimeAttributor } from "./mixinAttributor.js";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we going to fully remove mixinAttributor in a later change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All that mixinAttributor does now is override loadRuntime (yay, it doesn't have to mix in summarization stuff anymore!).

All that loadRuntime is doing inside can be flipped around and done outside/around the call to ContainerRuntime.loadRuntime, with one exception - adding the IRuntimeAttributor getter. I don't think we want that anyway - getRuntimeAttributor should be used instead.

So instead of using the mixin pattern, we can just have a helper function loadRuntimeWithAttribution which does everything that the loadRuntime override does, besides messing with the private field (which no longer applies / is needed).

I would not suggest doing this in this PR, but I would suggest/request we do it soon after. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the getter on the container runtime as we can use the utility method to get it. But we do need to mixin as we need to inject the registry and tracking options for the attributor before container runtime is loaded, although we did remove a lot of stuff already.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what I'm saying still works though - when you have a minute, try moving ContainerRuntimeWithAttributor.loadRuntime to be a free function. It should work fine and you can remove the whole ContainerRuntimeWithAttributor class.

Then where today callers have to call mixinRuntime and then call loadRuntime on the result, they can instead just call that one function (instead of calling loadRuntime directly)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look here how we use it here in the tests:

The benefit of overriding the ctor is that you can just use the override while creating the runtime factory rather than having to differentiate what to use much later/down the line when the runtime is getting created?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Abe27342 Any suggestions here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, interesting. Yeah that would take some untangling. Worth doing later IMO, none of this is blocking this PR, the shrinking you did on that mixin is awesome.

/**
* {@inheritdoc IFluidDataStoreChannel.setAttachState}
*/
public setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish you didn't have to write this code here... I know this area has been bug-prone before, and I'm not sure anyone will know to come fix any issues here if they are discovered in the similar code in the main datastore runtime implementation.

No suggestion here, just wanting to point it out.

Copy link
Member

@markfields markfields left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jatgarg jatgarg merged commit bcfda79 into microsoft:main Aug 16, 2024
30 checks passed
@jatgarg jatgarg deleted the attribution branch August 16, 2024 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: tests Tests to add, test infrastructure improvements, etc base: main PRs targeted against main branch dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants