Skip to content
Snippets Groups Projects

Add configuration for lease maintenance behavior

Fixes #169 (closed)

Probably done but I'm going to integrate it w/ GridSync before saying so for sure.

Per discussion elsewhere, GridSync also/instead needs a different integration point for answering the question it has. So this is probably fine as-is (and maybe also not useful in the near term - but still maybe useful in the long term, and at least not harmful right now).

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Jean-Paul Calderone
  • Administrator
    Administrator @root started a thread on commit a5618bbb
  • 75 )
    76
    77
    78 def _read_duration(cfg, option, default):
    79 """
    80 Read an integer number of seconds from the ZKAPAuthorizer section of a
    81 Tahoe-LAFS config.
    82
    83 :param cfg: The Tahoe-LAFS config object to consult.
    84 :param option: The name of the option to read.
    85
    86 :return: ``None`` if the option is missing, otherwise the parsed duration
    87 as a ``timedelta``.
    88 """
    89 # type: (_Config, str) -> Optional[timedelta]
    90 section_name = u"storageclient.plugins.privatestorageio-zkapauthz-v1"
    • Created by: tomprince

      This feels like a weird place for this constant. I'd prefer if this were passed in from _plugin. (If we had infinite time, I'd likely suggest having an object wrapping the node config, that reads from a particular section, but it probably isn't worth the effort here yet).

  • Administrator
    Administrator @root started a thread on commit a5618bbb
  • 2 #
    3 # Licensed under the Apache License, Version 2.0 (the "License");
    4 # you may not use this file except in compliance with the License.
    5 # You may obtain a copy of the License at
    6 #
    7 # http://www.apache.org/licenses/LICENSE-2.0
    8 #
    9 # Unless required by applicable law or agreed to in writing, software
    10 # distributed under the License is distributed on an "AS IS" BASIS,
    11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12 # See the License for the specific language governing permissions and
    13 # limitations under the License.
    14
    15 """
    16 Helpers for reading values from the Tahoe-LAFS configuration.
    17 """
    • Created by: tomprince

      I wonder if we want to have separate modules for client and server config. Other than empty_config (which I guess is a test fixture), all the stuff here is client specific.

    • Could be, yea. Since this project started it has become clear that two different plugins may have made more sense than a single plugin with such a tightly coupled implementation. We could probably try to keep the pieces as separate as possible until a more definitive decoupling happens. I'll keep it in mind for future development.

  • Created by: tomprince

    Review: Approved

    Looks good. It would be nice if the config section to read from was not hard-coded in a leaf function, but that isn't blocking.

  • 75 )
    76
    77
    78 def _read_duration(cfg, option, default):
    79 """
    80 Read an integer number of seconds from the ZKAPAuthorizer section of a
    81 Tahoe-LAFS config.
    82
    83 :param cfg: The Tahoe-LAFS config object to consult.
    84 :param option: The name of the option to read.
    85
    86 :return: ``None`` if the option is missing, otherwise the parsed duration
    87 as a ``timedelta``.
    88 """
    89 # type: (_Config, str) -> Optional[timedelta]
    90 section_name = u"storageclient.plugins.privatestorageio-zkapauthz-v1"
    Please register or sign in to reply
    Loading