-
Notifications
You must be signed in to change notification settings - Fork 334
Move search operations to UserSubsystem #4188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 45 commits
aa014bf
cac29c2
082fdcd
aac6ed0
c234972
63afe93
d732248
e46d019
e0c68fa
d0272df
9fab12e
f170493
46e8629
1a0f892
b0391e4
78d8856
4ad948f
67a3617
459c6b8
2560436
d77a0c1
39b4ea0
01efe6a
c664d34
4ec43a2
f614653
542f5ba
0ec354b
0369090
ec8a5d5
3e25c07
559e154
63e3c4b
b6f08d2
66a97d7
ede2aa1
15a2c44
1806e82
7d0d0c7
99ab272
8c73d31
1446cdb
d8bac42
1861511
69ce200
6fc44e9
7404df1
55cc084
4b39d28
d479ed6
567a8d3
e7017f5
01fa1bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Removed `indexReindex` and `indexReindexIfSameOrNewer` from internal Brig/SearchIndex. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Introduced ElasticSearch effects related to user search. |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
|
|
||
| module Wire.Sem.Metrics where | ||
|
|
||
| import Imports | ||
| import Polysemy | ||
| import Prometheus (Counter, Gauge) | ||
|
|
||
| -- | NOTE: Vectors would require non trival changes because | ||
| -- 'Prometheus.withLabel' take a paramter of type 'metric -> IO ()'. | ||
| data Metrics m a where | ||
| AddCounter :: Counter -> Double -> Metrics m () | ||
| AddGauge :: Gauge -> Double -> Metrics m () | ||
|
|
||
| makeSem ''Metrics | ||
|
|
||
| incCounter :: (Member Metrics r) => Counter -> Sem r () | ||
| incCounter c = addCounter c 1 | ||
|
|
||
| incGauge :: (Member Metrics r) => Gauge -> Sem r () | ||
| incGauge c = addGauge c 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| module Wire.Sem.Metrics.IO where | ||
|
|
||
| import Imports | ||
| import Polysemy | ||
| import qualified Prometheus as Prom | ||
| import Wire.Sem.Metrics | ||
|
|
||
| runMetricsToIO :: (Member (Embed IO) r) => InterpreterFor Metrics r | ||
| runMetricsToIO = interpret $ \case | ||
| AddCounter c n -> embed . void $ Prom.addCounter @IO c n | ||
| AddGauge g n -> embed $ Prom.addGauge @IO g n | ||
|
|
||
| ignoreMetrics :: InterpreterFor Metrics r | ||
| ignoreMetrics = interpret $ \case | ||
| AddCounter _ _ -> pure () | ||
| AddGauge _ _ -> pure () |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ data BrigError | |
| | NotConnected | ||
| | InvalidTransition | ||
| | NoIdentity | ||
| | NoUser | ||
| | HandleExists | ||
| | InvalidHandle | ||
| | HandleNotFound | ||
|
|
@@ -170,6 +171,8 @@ type instance MapError 'InvalidTransition = 'StaticError 403 "bad-conn-update" " | |
|
|
||
| type instance MapError 'NoIdentity = 'StaticError 403 "no-identity" "The user has no verified email" | ||
|
|
||
| type instance MapError 'NoUser = 'StaticError 403 "no-user" "The user does not exist" | ||
|
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What was the error before the refactoring?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "TODO: searcher doesn't exist" :)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was asking about before this PR started. This PR is supposed to be a refactoring, so ideally we wouldn't be inventing new user visible errors. So it'd be great to know what was the previous behaviour.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like we've introduced this error, but for no good reason. I'm refactoring the code so we don't need to throw the error.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This type instance is gone now and we don't throw a new error anymore compared to the old code. |
||
| type instance MapError 'HandleExists = 'StaticError 409 "handle-exists" "The given handle is already taken" | ||
|
|
||
| type instance MapError 'InvalidHandle = 'StaticError 400 "invalid-handle" "The given handle is invalid (less than 2 or more than 256 characters; chars not in \"a-z0-9_.-\"; or on the blocklist)" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.