pingcap / pingcap/tiproxy

Refactor package `backend` to decouple interfaces

Open
#439 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

refactor
Dominant language
Go
Stars
73
Forks
41
Avg merge
21h 3m
Merged PRs (30d)
21

Description

Development Task

Currently, BackendConnMgr calls structs Authenticator and CmdProcessor directly, which makes them coupled. It makes UT more complicated, and it will be hard to extend this module. E.g, we may override some behaviors through plugins.

We can define interface Auth for Authenticator and CmdEngine for CmdProcessor. UT can mock implementations and plugins can override the default implementation by defining another implementation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the backend package by tracing how BackendConnMgr calls Authenticator and CmdProcessor, then inspect the existing unit tests. Define the Auth and CmdEngine interfaces around the required behavior and update the manager to use implementations, including mock implementations in tests. Done means unit tests can mock both collaborators and alternate plugin implementations can provide them.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.