#3830 closed defect (fixed)

LeaseInfo invites the anti-pattern of external mutation

Reported by: exarkun Owned by: exarkun
Priority: normal Milestone: undecided
Component: unknown Version: n/a
Keywords: Cc:
Launchpad Bug:

Description

The way the expiration time of a lease is updated is that a LeaseInfo has its expiration_time attribute mutated and then the object is serialized into a share file.

"Set an attribute" as an API is an anti-pattern because:

  • attribute setting is minimally discoverable
  • attribute setting is prone to delayed failure (it is typically not an error to set the wrong attribute)
  • mutation un-localizes behavior and makes reasoning more difficult

Change History (1)

comment:1 Changed at 2021-10-29T11:15:00Z by GitHub <noreply@…>

  • Resolution set to fixed
  • Status changed from new to closed

In f9c2a06/trunk:

Merge pull request #1149 from tahoe-lafs/3830.immutable-lease-info

Make LeaseInfo? immutable

Fixes: ticket:3830

Note: See TracTickets for help on using tickets.