-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce pool info cache fields and update pool_info accordingly, Remov…
…e pool info cache reference from pool_relays and pool_metadata
- Loading branch information
Showing
10 changed files
with
132 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
CREATE OR REPLACE FUNCTION grest.pool_relays() | ||
RETURNS TABLE ( | ||
pool_id_bech32 character varying, | ||
relays jsonb [], | ||
pool_status text | ||
relays jsonb | ||
) | ||
LANGUAGE plpgsql | ||
LANGUAGE sql STABLE | ||
AS $$ | ||
#variable_conflict use_column | ||
BEGIN | ||
RETURN QUERY | ||
SELECT DISTINCT ON (pool_id_bech32) | ||
pool_id_bech32, | ||
relays, | ||
pool_status | ||
FROM grest.pool_info_cache | ||
SELECT DISTINCT ON (ph.view) | ||
ph.view AS pool_id_bech32, | ||
JSONB_AGG(JSONB_BUILD_OBJECT ( | ||
'ipv4', pr.ipv4, | ||
'ipv6', pr.ipv6, | ||
'dns', pr.dns_name, | ||
'srv', pr.dns_srv_name, | ||
'port', pr.port | ||
)) AS relays | ||
FROM public.pool_hash AS ph | ||
LEFT JOIN public.pool_update AS pu ON pu.hash_id = ph.id | ||
LEFT JOIN public.pool_relay AS pr ON pu.id = pr.update_id | ||
GROUP BY ph.view,pu.registered_tx_id | ||
ORDER BY | ||
pool_id_bech32, | ||
tx_id DESC; | ||
END; | ||
ph.view, | ||
pu.registered_tx_id DESC | ||
; | ||
$$; | ||
|
||
COMMENT ON FUNCTION grest.pool_relays IS 'A list of registered relays for all pools'; --noqa: LT01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.