Skip to content

Commit 8fdf9cd

Browse files
authored
Update Hosts & Loaders + Fix Image issue (#3242)
1 parent aab98d2 commit 8fdf9cd

File tree

7 files changed

+115
-8
lines changed

7 files changed

+115
-8
lines changed

docs/content/docs/concepts/architecture/index.md docs/content/docs/concepts/architecture.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ Objects can have state, which is managed by Distributed Data Structures (DDSes).
2020
DDSes are used to distribute state to clients. Instead of centralizing merge logic in the
2121
server, the server passes changes (aka operations or ops) to clients and the clients perform the merge.
2222

23-
![A diagram of the Fluid Framework architecture](./images/architecture.png)
24-
23+
![A diagram of the Fluid Framework architecture](/docs/concepts/images/architecture.png)
2524

2625
## Design decisions
2726

@@ -61,8 +60,8 @@ client, gives the op a sequential order number, and sends the ordered op back to
6160
structures use these ops to reconstruct state on each client. The Fluid service doesn't parse any of these ops; in fact,
6261
the service knows nothing about the contents of any Fluid container.
6362

64-
![A diagram depicting operations being sent from a Fluid client to a Fluid service](./images/op-send.png)
65-
![A diagram depicting operations being broadcast to Fluid clients](./images/op-broadcast.png)
63+
![A diagram depicting operations being sent from a Fluid client to a Fluid service](/docs/concepts/images/op-send.png)
64+
![A diagram depicting operations being broadcast to Fluid clients](/docs/concepts/images/op-broadcast.png)
6665

6766
From the client perspective, this op flow is accessed through a **DeltaConnection** object.
6867

@@ -78,7 +77,7 @@ Fluid container code. In this way, the Fluid loader 'mimics the web.' The Fluid
7877
resolver,** connects to the Fluid service using the **Fluid service driver**, and loads the correct app code using the
7978
**code loader.**
8079

81-
![A diagram of the Fluid loading sequence](./images/load-flow.png)
80+
![A diagram of the Fluid loading sequence](/docs/concepts/images/load-flow.png)
8281

8382
**Container lookup & resolver** identifies, by a URL, which service a container is bound to and where in that service it
8483
is located. The Fluid service driver consumes this information.
@@ -100,4 +99,4 @@ used to replicate data across connected clients, but can also include additional
10099
incapsulated in our lowest level objects, **distributed data structures (DDS)**. App logic operating over this data is
101100
stored in **Fluid objects**.
102101

103-
![A diagram of the Fluid loading sequence](./images/fluid-objects.png)
102+
![A diagram of the Fluid loading sequence](/docs/concepts/images/fluid-objects.png)

docs/content/docs/concepts/hosts.md

+110-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,114 @@
11
---
2-
title: Hosts and the Loader
2+
title: Hosts and the loader
33
menuPosition: 4
44
---
55

6-
## NOT YET WRITTEN
6+
The **Fluid loader** is one of the key parts of the Fluid Framework. Developers use the Fluid loader within their
7+
applications to load Fluid containers and to initiate communication with the Fluid service.
8+
9+
A **Fluid host** is any application that uses the Fluid loader to load a Fluid container.
10+
11+
The Fluid loader uses a plugin model.
12+
13+
14+
## Who needs a Fluid loader?
15+
16+
If your app or website will load a Fluid container, then you are creating a Fluid host and you will need to use the
17+
Fluid loader!
18+
19+
If you are building a Fluid container and you will not build a standalone application with Fluid, you may still be
20+
interested in learning about the Fluid loader. The Fluid loader includes capabilities, such as host scopes, that are used
21+
by containers.
22+
23+
You may also want to host your Fluid container on a standalone website.
24+
25+
26+
## Summary
27+
28+
The Fluid loader loads Fluid containers by connecting to the Fluid service and fetching Fluid container code. From a
29+
system architecture perspective, the Fluid loader sits in between the Fluid service and a Fluid container.
30+
31+
![A diagram of the Fluid Framework system architecture](/docs/concepts/images/architecture.png)
32+
33+
The Fluid loader is intended to be extremely generic. To maintain generic-ness, the loader uses a plugin model. With the
34+
right plugins (drivers, handlers, resolvers), the Fluid loader will work for any wire protocol and any service
35+
implementation.
36+
37+
The loader mimicks existing web protocols. Similar to how the browser requests state and app logic (a website) from a
38+
web server, a Fluid host uses the loader to request a [Fluid container](./containers-runtime.md) from the Fluid service.
39+
40+
## host responsibilities
41+
42+
A Fluid host creates a Fluid loader with a URL resolver, Fluid service driver, and code loader. The host then requests a
43+
Fluid container from the loader. Finally, the host *does something* with the Fluid containers. A host can request
44+
multiple containers from the loader.
45+
46+
![The loader architecture and request flow](/docs/concepts/images/load-flow.png)
47+
48+
We'll talk about each of these parts, starting with the request and loader dependencies, over the next sections.
49+
50+
## Loading a container - Class by Class
51+
52+
Let's address the role of each part of the Fluid loader and dive in to some details.
53+
54+
### Request
55+
56+
The request includes a Fluid container URL and optional header information. This URL contains a protocol and other
57+
information that will be parsed by the URL Resolver to identify where the container is located.
58+
59+
This is not part of instantiating the loader. The request kicks of the process of loading a container.
60+
61+
### URL Resolver
62+
63+
The URL Resolver parses a request and returns an `IFluidResolvedUrl`. This object includes all the endpoints and tokens
64+
needed by the Fluid service driver to access the container.
65+
66+
An example IFluidResolvedUrl includes the below information.
67+
68+
```typescript
69+
const resolvedUrl: IFluidResolvedUrl = {
70+
endpoints: {
71+
deltaStorageUrl: "www.ContosoFluidService.com/deltaStorage",
72+
ordererUrl: "www.ContosoFluidService.com/orderer"
73+
storageUrl: "www.ContosoFluidService.com/storage",
74+
},
75+
tokens: { jwt: "token" },
76+
type: "fluid",
77+
url: "fluid://www.ContosoFluidService.com/ContosoTenant/documentIdentifier",
78+
}
79+
```
80+
81+
You may notice we are mimicking the DNS and protocol lookup a browser performs when loading a webpage. That's because a
82+
loader may access containers stored on multiple Fluid services. Furthermore, each Fluid service could be operating with
83+
a different API and protocol.
84+
85+
### Fluid service driver (DocumentServiceFactory)
86+
87+
The loader uses a Fluid service driver to connect to a Fluid service.
88+
89+
While many developers will only load one container at a time, it's interesting to consider how the loader handles
90+
loading two containers that are stored on different Fluid services. To keep track of the services, the loader uses the
91+
protocol from the resolved URL to identify the correct Fluid service driver for the Fluid service.
92+
93+
### Code loader
94+
95+
The loader uses the code loader to fetch container code. Because a Fluid container is a app logic and distributed state
96+
we need all of the connected clients to agree on the same container code.
97+
98+
### Scopes
99+
100+
Scopes allow the container access to resources from the host. For example, the host may have access to an authorization
101+
context that the container code is not trusted to access. The host can provide a scope to the container that federates
102+
access to the secure resource.
103+
104+
## Handling the response
105+
106+
The Fluid loader will return a response object from the request. This is a continuation of our web protocol metaphor,
107+
you'll receive an object with a mimeType (e.g. "fluid/object"), response status (e.g. 200), and a value (e.g. the Fluid
108+
object).
109+
110+
The host is responsible for checking that this response is valid. Did the loader return a 200? Is the mimeType correct?
111+
As the Fluid Framework expands, we intend to make further use of these responses.
112+
113+
The host can then use [feature detection via IFluidObject](./feature-detection-iprovide.md) to query for features and
114+
then integrate the container into the application.

0 commit comments

Comments
 (0)