Pass the full Tahoe-LAFS configuration IFoolscapStoragePlugin.get_client_resource #3242

Closed
opened 2019-08-16 19:21:35 +00:00 by exarkun · 4 comments

IFoolscapStoragePlugin methods are defined as taking a dict containing only the part of tahoe.cfg that is specifically for them. That is, the server method gets the contents of the [name>]storage.plugins.<plugin section and the client methods get the [name>]storageclient.plugins.<plugin section.

This was done to try to keep the values access as limited as possible. All else being equal, fewer things is better than more things.

However, it seems clear now that this is too limited. For example, a plugin can't even find the node directory with this little information. If a plugin wants to keep some state with the node, it has no way to know where that should be.

The _Config object is much more useful and provides helpful abstractions that we would like to encourage to be used in Python code - for example, write_private_config instead of finding out the node directory, constructing a path to a file in the private directory, and then directly performing I/O on that file.

So, instead of passing only the plugin's config section, pass a _Config instance.

IFoolscapStoragePlugin methods are defined as taking a dict containing only the part of tahoe.cfg that is specifically for them. That is, the server method gets the contents of the `[name>]storage.plugins.<plugin` section and the client methods get the `[name>]storageclient.plugins.<plugin` section. This was done to try to keep the values access as limited as possible. All else being equal, fewer things is better than more things. However, it seems clear now that this is too limited. For example, a plugin can't even find the node directory with this little information. If a plugin wants to keep some state with the node, it has no way to know where that should be. The `_Config` object is much more useful and provides helpful abstractions that we would like to encourage to be used in Python code - for example, `write_private_config` instead of finding out the node directory, constructing a path to a file in the private directory, and then directly performing I/O on that file. So, instead of passing only the plugin's config section, pass a `_Config` instance.
exarkun added the
unknown
normal
defect
n/a
labels 2019-08-16 19:21:35 +00:00
exarkun added this to the storage economics plugins milestone 2019-08-16 19:21:35 +00:00
Author

To keep the changeset small, I'll do this a piece at a time. First, get_client_resource.

To keep the changeset small, I'll do this a piece at a time. First, `get_client_resource`.
exarkun changed title from Pass the full Tahoe-LAFS configuration to IFoolscapStoragePlugin methods to Pass the full Tahoe-LAFS configuration IFoolscapStoragePlugin.get_client_resource 2019-08-19 15:36:01 +00:00
Author
(https://github.com/tahoe-lafs/tahoe-lafs/pull/650)
Author
Merged into integration branch in <https://github.com/tahoe-lafs/tahoe-lafs/commit/2c9e724996a278b20596d506b37fa45bc17ac996>
exarkun added the
fixed
label 2019-10-01 18:28:30 +00:00
GitHub <noreply@github.com> commented 2019-11-18 13:45:40 +00:00
Owner

In 2c9e724/trunk:

Merge pull request #650 from tahoe-lafs/3242.pass-config-object-to-storage-plugin-client-resource

Pass _Config object to storage plugin client resource

Fixes: ticket:3242
In [2c9e724/trunk](/tahoe-lafs/trac-2024-07-25/commit/2c9e724996a278b20596d506b37fa45bc17ac996): ``` Merge pull request #650 from tahoe-lafs/3242.pass-config-object-to-storage-plugin-client-resource Pass _Config object to storage plugin client resource Fixes: ticket:3242 ```
Sign in to join this conversation.
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#3242
No description provided.