letsencrypt / letsencrypt/boulder

Factor out database initialization code from SA

Open
#8,874 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
5.8k
Forks
649
Avg merge
3d 23h
Merged PRs (30d)
24

Description

In sa/database.go, we have InitWrappedDB, which does a variety of things, in particular:

  • Sets up the borp type<->table mapping.
  • Sets connection lifetimes and limits from a cmd.DBConfig.
  • Configures metrics.
  • Calls db.NewWrappedMap (annotates DB errors with extra info).

We should factor InitWrappedDB into its own package, for use with any database operations that might not want the same borp type<->table mapping as the SA, or that might not want to depend on the SA.

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 sa/database.go at InitWrappedDB and trace its callers and the four responsibilities listed in the issue. Identify the package boundary that lets other database operations reuse connection limits, metrics, and wrapped errors without depending on the SA or its borp mapping; done means those uses remain correctly initialized while the SA-specific mapping can differ.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.