Skip to content

Draft: alternative manager versioning proposal

akrokr requested to merge akh/mgr_ver into develop

This is a proposal (similar to !2998 (merged)) for how to version managers. The idea is to use a standard versioning scheme for functions across the repo (as opposed to the special-case versioning of an entire class for managers). 2998 is all good, this is just my personal preference that I figured I'd put up in case folks like it.

incremental transition:

  • remove V[0-9]+$ from manager class and unit test suite
  • remove _current from current manager and unit test file
  • change most recent managers.go case to use non-versioned class (only once, never have to touch managers.go for that manager again)
  • version member functions as needed, following same pattern as handlers:
    • funcName() is the router
    • funcNameVXXX() are the versioned functions with the same params, called by the router
    • old versions move to _archive.go

linter (TODO):

  • functions whose names end in V[0-9]+ must have a corresponding router function
  • cannot edit a versioned function if its version < current version

generation tools (TODO):

  • $ gen upgrade-protocol [major|minor] # version and openapi change
  • $ gen upgrade-function x.thorchain.TxOutStorage.prepareTxOutItem # create router if needed, add new case to router, move previous to archive
  • $ gen upgrade-touched # upgrade-function for each function touched

Merge request reports