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

Avoid exporting SharedObject as public #19717

Merged
merged 44 commits into from
Mar 7, 2024

Conversation

CraigMacomber
Copy link
Contributor

@CraigMacomber CraigMacomber commented Feb 20, 2024

Description

Remove the requirement that factories are classes, then avoid exporting DDS classes and SharedObject (and some related types) as public: they are instead exported as @alpha.

Breaking Changes

Users of DDS concreate classes should migrate onto the corresponding interface types.
Any code using APIs intended only for authoring of new DDSes (such as SharedObject, SharedObjectCore and EventEmitterWithErrorHandling) will have to use the unstable @alpha APIs, and should find alternatives or be up streamed into this repository.

This also makes ContainerSchema read-only: as this type is intended for defining input to the these packages this should make the APIs more tolerant and thus be non-breaking, however its possible for some users of this type to use it in ways where this could be a breaking change: any such users should remove their mutations and/or use different types.

Reviewer Guidance

The review process is outlined on this wiki page.

This makes several related changes, but as they are related and small enough that it seems reasonable for them to be grouped like this. If you would prefer them split up let me know.

@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: runtime Runtime related issues public api change Changes to a public API base: main PRs targeted against main branch labels Feb 20, 2024
@DLehenbauer
Copy link
Contributor

FYI - @anthony-murphy and/or @ChumpChief have expressed interest in this improving this area in the past.

@github-actions github-actions bot added area: tests Tests to add, test infrastructure improvements, etc dependencies Pull requests that update a dependency file labels Mar 2, 2024
@CraigMacomber CraigMacomber changed the title Half fix factory Avoid exporting SharedObject as public Mar 2, 2024
@CraigMacomber
Copy link
Contributor Author

It should be working now. A lot of these changes can be pulling into a separate PR (ex: using the interfaces instead of concreate types when practical). Once that's been done, this PR will be more carefully evaluated and have its breaking changes documented.

@github-actions github-actions bot removed the area: examples Changes that focus on our examples label Mar 5, 2024
CraigMacomber added a commit that referenced this pull request Mar 7, 2024
## Description

Add TChannel type parameter to IChannelFactory, and a few related
cleanups.

Changes split out from
#19717

## Breaking Changes

Add TChannel type parameter (which defaults to IFluidLoadable) to
IChannelFactory. When left at its default this preserves the old
behavior, however packages exporting IChannelFactory will now reference
IFluidLoadable if not providing a different parameter and thus will
implicitly depend on @fluidframework/core-interfaces

SharedCounter.create now returns ISharedCounter instead of SharedCounter
@github-actions github-actions bot removed dependencies Pull requests that update a dependency file area: runtime Runtime related issues labels Mar 7, 2024
@CraigMacomber CraigMacomber marked this pull request as ready for review March 7, 2024 02:26
@CraigMacomber CraigMacomber requested a review from a team as a code owner March 7, 2024 02:26
protected summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
values(): IterableIterator<any>;
}
export const SharedMap: {
Copy link
Contributor

@clarenceli-msft clarenceli-msft Mar 7, 2024

Choose a reason for hiding this comment

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

Glad to see that the exposure of the map API has been removed. I believe we can implement similar changes for SharedDirectory, I'm willing to take care of it.
AB#5799

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SharedDirectory is already exported as alpha, so its much less urgent (so I'm not doing it), but would be great to fix. I'm glad to have someone else take that on!


public static getFactory(): IChannelFactory<ITree> {
export const SharedTree = {
getFactory(): IChannelFactory<ITree> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added some docs, though documenting his is hard since it doesn't make a lot of sense to me.

readonly getFactory: () => IChannelFactory;
} & LoadableObjectCtor<T>;
export interface SharedObjectClass<T extends IFluidLoadable> {
readonly getFactory: () => IChannelFactory<T>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This whole API surface seems a bit screwy. Here we have an interface thats implemented in packages that arn't allowed to depend on this interface.

Also the interface is a factory factory for what seems like no reason (could be just the IChannelFactory).

This could really use another follow-up breaking change that rationalizes and document is. I'll minimally patch some of the docs gaps for now in this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added some docs, though documenting his is hard since it doesn't make a lot of sense to me.

@CraigMacomber CraigMacomber enabled auto-merge (squash) March 7, 2024 21:58
@CraigMacomber CraigMacomber merged commit ae1d0be into microsoft:main Mar 7, 2024
31 checks passed
clarenceli-msft added a commit that referenced this pull request Mar 27, 2024
Hide the class implementation of `SharedDirectory` and update the
corresponding exports, a follow up fix of
#19717


[AB#5799](https://dev.azure.com/fluidframework/internal/_workitems/edit/5799)

---------

Co-authored-by: Scarlett Lee <90647596+scarlettjlee@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: tree area: dds Issues related to distributed data structures 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 public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants