corteza icon indicating copy to clipboard operation
corteza copied to clipboard

Refactor packages under pkg/ and remove all component importing.

Open darh opened this issue 2 years ago • 9 comments

Many packages under pkg/ still reference type packages from components. This must be improved either by

  • moving the whole package from pkg into a component (federation)
  • moving package to the root (envoy, provision)
  • refactoring with generics or interfaces (Corredor, envoy?)

packages with component imports:

(for cmp in compose system federation types; do grep -r '/types"' pkg|grep "${cmp}/types"; done) | sort | cut -d '/' -f 1,2| uniq
  • [ ] pkg/apigw
  • [ ] pkg/auth
  • [x] pkg/codegen
  • [ ] pkg/corredor
  • [x] pkg/discovery
  • [ ] pkg/federation
  • [x] pkg/messagebus
  • [ ] pkg/provision
  • [x] pkg/seeder

Removed pkg/envoy; see my comment

darh avatar Nov 17 '22 12:11 darh

Stale issue message

github-actions[bot] avatar Jan 17 '23 06:01 github-actions[bot]

Apigw and messagebus: https://github.com/cortezaproject/corteza/tree/2023.3.x-feature-refactor-pkg

petergrlica avatar Mar 09 '23 16:03 petergrlica

Ignore pkg/envoy, it'll be removed and replaced with the new implementation when fully ported over

tjerman avatar Mar 17 '23 10:03 tjerman

Spit the work between one another so that Vivek works max 2d on this

katrinDY avatar Mar 17 '23 12:03 katrinDY

For now, skipping pkg/provision, pkg/corredor, pkg/auth(TBD either to move it to root or refactor inside pkg/auth).

vicpatel avatar Apr 05 '23 08:04 vicpatel

Todo @vicpatel :

  • Clarify a bit on why we're skipping the above packages, problems, solutions, ...
  • Consider updating this issue (re-open and move to some backlog), OR open new issue(s) for the new bits.

Additional work (refactoring the packages to be moved to the root (or similar) should be discussed with the rest of the (BE) devs.

tjerman avatar Apr 13 '23 09:04 tjerman

---- pkg/auth -- server/pkg/auth/system.go; there is use of system type, so we can move handlers to system types, instead of moving whole pkg.

  • Why# It's been used mainly at boot level; It's good to have dedicate pkg/auth. Since It's bit complex to move it out of pkg bc it might force us to keep service intialization in dedicated order.

---- pkg/corredor -- Again there is use of system/types, mostly for User struct; so we need have interfaces for user, to remove usage of system types from this pkg.

---- pkg/provision -- There is use of compose and system types, so move it root or refactoring it(pkg/provision) by having generic interfaces from both component(compose/system) as need to remove usage of component types.

vicpatel avatar Apr 14 '23 13:04 vicpatel

We can use this issue for disscussion then either use this issue or have separate tasks.

vicpatel avatar Apr 14 '23 13:04 vicpatel

Stale issue message

github-actions[bot] avatar Jul 08 '23 06:07 github-actions[bot]