Convert TmchCrl and ServerSecret to cleaner tm() impls (#1068)

* Convert TmchCrl and ServerSecret to cleaner tm() impls

When I implemented this originally I knew a lot less than I know now
about how we'll be storing and retrieving these singletons from SQL. The
optimal way here is to use the single SINGLETON_ID as the primary key,
that way we always know how to create the key that we can use in the
tm() retrieval.

This allows us to use generic tm() methods and to remove the handcrafted
SQL queries.
This commit is contained in:
gbrodman 2021-04-13 20:50:07 -04:00 committed by GitHub
parent 245e2ea5a8
commit d35460f14c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 285 additions and 343 deletions

View file

@ -948,7 +948,8 @@ ALTER SEQUENCE public."SafeBrowsingThreat_id_seq" OWNED BY public."Spec11ThreatM
--
CREATE TABLE public."ServerSecret" (
secret uuid NOT NULL
secret uuid NOT NULL,
id bigint NOT NULL
);
@ -1055,7 +1056,8 @@ CREATE TABLE public."Tld" (
CREATE TABLE public."TmchCrl" (
certificate_revocations text NOT NULL,
update_timestamp timestamp with time zone NOT NULL,
url text NOT NULL
url text NOT NULL,
id bigint NOT NULL
);
@ -1389,7 +1391,7 @@ ALTER TABLE ONLY public."Spec11ThreatMatch"
--
ALTER TABLE ONLY public."ServerSecret"
ADD CONSTRAINT "ServerSecret_pkey" PRIMARY KEY (secret);
ADD CONSTRAINT "ServerSecret_pkey" PRIMARY KEY (id);
--
@ -1429,7 +1431,7 @@ ALTER TABLE ONLY public."Tld"
--
ALTER TABLE ONLY public."TmchCrl"
ADD CONSTRAINT "TmchCrl_pkey" PRIMARY KEY (certificate_revocations, update_timestamp, url);
ADD CONSTRAINT "TmchCrl_pkey" PRIMARY KEY (id);
--