-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc(server): add basic architecture overview of resource manager (#2401)
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Resource Manager | ||
|
||
`ResourceManager` provides reusable shared operations among resources. This includes the CRUD operations via HTTP, support for different output encodings (yaml or JSON), and Provisioning. | ||
|
||
|
||
## What is a Resource? | ||
|
||
A `Resource` is, conceptually, any entity that can be created, read, updated and/or deleted. | ||
Some examples in Tracetest includes `Test`, `Transaction`, `PollingProfile`, etc. | ||
|
||
## How this works | ||
|
||
A `ResourceManager` can be instantiated with a few arguments: | ||
- Resource name, singular and plural, | ||
- List of enabled operations, | ||
- Handler | ||
|
||
The handler is a class that handles the persistence of entities. It must support **at least** the required methods for the enabled operations. | ||
|
||
For example, a resource that wants to enable the `create` operation needs to provide a Handler that has a `Create` method. | ||
|
||
The provisioning process is handled by an external `Provisioner` class, but the `ResourceManager` instance handles the actual provisioning, meaning the actual persistence of the provisioning data. | ||
|
||
Here is a flow of a `ResourceManager` setup process: | ||
|
||
```mermaid | ||
--- | ||
title: Instantiating a new ResourceManager | ||
--- | ||
stateDiagram-v2 | ||
Setup: Instantiate ResourceManager | ||
app --> Setup | ||
Setup --> Registering | ||
state Setup { | ||
validateHandler: check that \n handler implements \n the registered operations | ||
bind: Bind handler methods to http handlers | ||
[*] --> validateHandler | ||
validateHandler --> bind | ||
} | ||
state Registering { | ||
registerRoutes: create mux subrouter \n with http handlers | ||
registerProvisioner: add new ResourceManager \n to provisioner registry | ||
[*] --> registerRoutes | ||
registerRoutes --> registerProvisioner | ||
} | ||
``` | ||
|
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,6 @@ | ||
# Wiki Index | ||
|
||
|
||
## Architecture | ||
|
||
1. [Resource Manager](../server/resourcemanager/README.md) |