Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions docs/build-modules/module-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,15 @@ if __name__ == '__main__':

The default behavior when you don't implement a method:

| Behavior | Go | Python |
| ------------------------ | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
| Rebuild on config change | Default (`viam-server` destroys and re-creates the resource) | Default (`viam-server` destroys and re-creates the resource) |
| In-place reconfigure | Not supported for modular resources | Implement `reconfigure()` (called if your class satisfies the `Reconfigurable` protocol) |
| No-op close | Embed `resource.TriviallyCloseable` | Default on `ResourceBase` |
| Skip config validation | Embed `resource.TriviallyValidateConfig` | Default on `EasyResource` |
| To get this behavior | Go | Python |
| ---------------------- | ---------------------------------------- | ------------------------- |
| No-op close | Embed `resource.TriviallyCloseable` | Default on `ResourceBase` |
| Skip config validation | Embed `resource.TriviallyValidateConfig` | Default on `EasyResource` |

`viam-server` always rebuilds modular resources when their configuration
or dependencies change. It closes the existing resource instance and
creates a new one using the constructor. In-place reconfiguration is not
supported for modular resources in any language.

## Logging

Expand Down Expand Up @@ -331,13 +334,13 @@ defined in `proto/viam/module/v1/module.proto`:

All RPCs are initiated by `viam-server` and handled by the module:

| RPC | Purpose |
| --------------------- | -------------------------------------------------------- |
| `Ready` | Handshake: module returns its supported API/model pairs. |
| `AddResource` | Create a new resource instance from config. |
| `ReconfigureResource` | Update an existing resource with new config. |
| `RemoveResource` | Destroy a resource instance. |
| `ValidateConfig` | Validate config and return implicit dependencies. |
| RPC | Purpose |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `Ready` | Handshake: module returns its supported API/model pairs. |
| `AddResource` | Create a new resource instance from config. |
| `ReconfigureResource` | Rebuild an existing resource with new config (removes and re-creates the resource). The name is retained for compatibility. |
| `RemoveResource` | Destroy a resource instance. |
| `ValidateConfig` | Validate config and return implicit dependencies. |

The module also connects back to the parent `viam-server` to access other
resources (dependencies) on the machine.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Reconfigure this resource.
Reconfigure must reconfigure the resource atomically and in place.
Reconstruct this resource.
For modular resources, reconstruction destroys the existing resource instance and creates a new one using the constructor.
Loading