FluidFramework icon indicating copy to clipboard operation
FluidFramework copied to clipboard

Close Container From DataStore

Open anthony-murphy opened this issue 4 years ago • 5 comments

Feature

We currently allow datastores to call raiseContainerWarning, but all this does is log and raise an event. In the event of a fatal error there isn't a way for a datastore to close a container.

Right now the only option is for a host to close a container on the container warning event, but this depends on the host doing to right thing depending on the error, and raiseContainerWarning is not called consistently making the right things hard to decide

anthony-murphy avatar Aug 13 '21 20:08 anthony-murphy

@vladsud and @curtisman curious what your thoughts are here.

an option could be to expose a container runtime scope for this. what i like about that is it up to the container Runtime if components have the power to close the container. it also opens the door for other actions, like making the container readonly, rather than closing

anthony-murphy avatar Aug 13 '21 20:08 anthony-murphy

There is ContainerRuntime.closeFn that is exposed through IContainerRuntime in some form. I have not looked at it for a while, this can be used to close container, may need some plumbing to make it accessible easily (if it's not on IContainerRuntimeBase).

I personally do not like global things like that (i.e. exposing on IContainerRuntimeBase, especially general purpose scope object that can do a lot of things), I think it's much better (even if it requires much more typing) for specific container runtime instance to make decision to expose (or not) some custom interface to object beneath it (data stores). And either have a way to provide it on both create & load, or provide it on create but make it serializable, such that data store could store it in its data model (DDSs) and rehydrate it later on load. That way it's a contract that someone made a decision to expose to specific user, same as in "normal programming" flow (i.e. essentially - avoid globals, pass things as explicit arguments to constructor).

vladsud avatar Aug 13 '21 20:08 vladsud

I only see closeFn expose off the container context interface, not on any of the runtime interfaces: https://github.com/microsoft/FluidFramework/blob/9092364501773d9fc622abc864a8307dff87f669/common/lib/container-definitions/src/runtime.ts#L110

container runtime does implement it: https://github.com/microsoft/FluidFramework/blob/1f3c3f8500d17f29c05f05a66278183696c60782/packages/runtime/container-runtime/src/containerRuntime.ts#L673

so it could be accessed with a case.

anthony-murphy avatar Aug 13 '21 22:08 anthony-murphy

This issue has been automatically marked as stale because it has had no activity for 180 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework!

ghost avatar Feb 10 '22 03:02 ghost

This issue has been automatically marked as stale because it has had no activity for 180 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework!

ghost avatar Aug 10 '22 03:08 ghost