-
Notifications
You must be signed in to change notification settings - Fork 532
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
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
28d4ec3
Convert attributor to IFluidDataStoreChannel
c83fe12
Convert attributor to IFluidDataStoreChannel
421c727
fix test
056c701
short codes
4cbd397
add comment
96c72aa
PR sugg
425734b
pr sugg
ef687cf
sugg
7b7c4e8
sugg
852cee1
sugg
6f5381e
add test
49c8fc1
add test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/*! | ||
* Copyright (c) Microsoft Corporation and contributors. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
import { | ||
type AttributionInfo, | ||
type AttributionKey, | ||
} from "@fluidframework/runtime-definitions/internal"; | ||
|
||
// Summary tree keys | ||
export const opBlobName = "opAttributor"; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const enableOnNewFileKey = "Fluid.Attribution.EnableOnNewFile"; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const IRuntimeAttributor: keyof IProvideRuntimeAttributor = "IRuntimeAttributor"; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export interface IProvideRuntimeAttributor { | ||
readonly IRuntimeAttributor: IRuntimeAttributor; | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const attributorDataStoreAlias = "attributor-cf9b6fe4-4c50-4a5d-9045-eb73b886f740"; | ||
|
||
/** | ||
* Provides access to attribution information stored on the container runtime. | ||
* | ||
* @remarks Attributors are only populated after the container runtime into which they are being injected has initialized. | ||
* | ||
* @sealed | ||
* @internal | ||
*/ | ||
export interface IRuntimeAttributor extends IProvideRuntimeAttributor { | ||
/** | ||
* @throws - If no AttributionInfo exists for this key. | ||
*/ | ||
get(key: AttributionKey): AttributionInfo; | ||
|
||
/** | ||
* @returns Whether any AttributionInfo exists for the provided key. | ||
*/ | ||
has(key: AttributionKey): boolean; | ||
|
||
/** | ||
* @returns Whether the runtime is currently tracking attribution information for the loaded container. | ||
* If enabled, the runtime attributor can be asked for the attribution info for different keys. | ||
* See {@link mixinAttributor} for more details on when this happens. | ||
*/ | ||
readonly isEnabled: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Are we going to fully remove
mixinAttributor
in a later change?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.
All that
mixinAttributor
does now is overrideloadRuntime
(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 toContainerRuntime.loadRuntime
, with one exception - adding theIRuntimeAttributor
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 theloadRuntime
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?
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.
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.
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.
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 wholeContainerRuntimeWithAttributor
class.Then where today callers have to call
mixinRuntime
and then callloadRuntime
on the result, they can instead just call that one function (instead of callingloadRuntime
directly)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.
Look here how we use it here in the tests:
FluidFramework/packages/test/test-version-utils/src/compatUtils.ts
Line 238 in 188b4d9
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?
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.
@Abe27342 Any suggestions here?
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.
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.