forgejo/models/db
pat-s 63a80bf2b9 feat: use XORM EngineGroup instead of single Engine connection (#7212)
Resolves #7207

Add new configuration to make XORM work with a main and replicas database instances. The follow configuration parameters were added:

- `HOST_PRIMARY`
- `HOST_REPLICAS`
- `LOAD_BALANCE_POLICY`. Options:
    - `"WeightRandom"` -> `xorm.WeightRandomPolicy`
    - `"WeightRoundRobin`  -> `WeightRoundRobinPolicy`
    - `"LeastCon"` -> `LeastConnPolicy`
    - `"RoundRobin"` -> `xorm.RoundRobinPolicy()`
    - default: `xorm.RandomPolicy()`
- `LOAD_BALANCE_WEIGHTS`

Co-authored-by: pat-s <patrick.schratz@gmail.com@>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7212
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
2025-03-30 11:34:02 +00:00
..
install chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
paginator chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
collation.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
common.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
consistency.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
context.go Small refactor to reduce unnecessary database queries and remove duplicated functions (#33779) 2025-03-09 15:05:24 +01:00
context_committer_test.go chore: use errors.New to replace fmt.Errorf with no parameters (#32800) 2024-12-15 09:15:57 +01:00
context_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
convert.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
engine.go feat: use XORM EngineGroup instead of single Engine connection (#7212) 2025-03-30 11:34:02 +00:00
engine_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
error.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
index.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
index_test.go feat: use XORM EngineGroup instead of single Engine connection (#7212) 2025-03-30 11:34:02 +00:00
iterate.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
iterate_test.go feat: use XORM EngineGroup instead of single Engine connection (#7212) 2025-03-30 11:34:02 +00:00
list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
list_test.go feat: use XORM EngineGroup instead of single Engine connection (#7212) 2025-03-30 11:34:02 +00:00
log.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
main_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
name.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
search.go [Refactor] Unify repo search order by logic (#30876) 2024-06-16 13:42:58 +02:00
sequence.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
sql_postgres_with_schema.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00