diff options
Diffstat (limited to 'src/mint/mint_db.h')
-rw-r--r-- | src/mint/mint_db.h | 84 |
1 files changed, 79 insertions, 5 deletions
diff --git a/src/mint/mint_db.h b/src/mint/mint_db.h index 64d72a350..5ed5db96c 100644 --- a/src/mint/mint_db.h +++ b/src/mint/mint_db.h | |||
@@ -83,6 +83,52 @@ int | |||
83 | TALER_MINT_DB_commit (PGconn *db_conn); | 83 | TALER_MINT_DB_commit (PGconn *db_conn); |
84 | 84 | ||
85 | 85 | ||
86 | |||
87 | /** | ||
88 | * Reserve row. Corresponds to table 'reserves' in the mint's | ||
89 | * database. FIXME: not sure this is how we want to store this | ||
90 | * information. Also, may currently used in different ways in the | ||
91 | * code, so we might need to separate the struct into different ones | ||
92 | * depending on the context it is used in. | ||
93 | */ | ||
94 | struct Reserve | ||
95 | { | ||
96 | /** | ||
97 | * Signature over the purse. | ||
98 | * Only valid if (blind_session_missing==GNUNET_YES). | ||
99 | */ | ||
100 | struct GNUNET_CRYPTO_EddsaSignature status_sig; | ||
101 | |||
102 | /** | ||
103 | * Signature with purpose TALER_SIGNATURE_PURSE. | ||
104 | * Only valid if (blind_session_missing==GNUNET_YES). | ||
105 | */ | ||
106 | struct GNUNET_CRYPTO_EccSignaturePurpose status_sig_purpose; | ||
107 | |||
108 | /** | ||
109 | * Signing key used to sign the purse. | ||
110 | * Only valid if (blind_session_missing==GNUNET_YES). | ||
111 | */ | ||
112 | struct GNUNET_CRYPTO_EddsaPublicKey status_sign_pub; | ||
113 | |||
114 | /** | ||
115 | * Withdraw public key, identifies the purse. | ||
116 | * Only the customer knows the corresponding private key. | ||
117 | */ | ||
118 | struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub; | ||
119 | |||
120 | /** | ||
121 | * Remaining balance in the purse. // FIXME: do not use NBO here! | ||
122 | */ | ||
123 | struct TALER_AmountNBO balance; | ||
124 | |||
125 | /** | ||
126 | * Expiration date for the purse. | ||
127 | */ | ||
128 | struct GNUNET_TIME_AbsoluteNBO expiration; | ||
129 | }; | ||
130 | |||
131 | |||
86 | int | 132 | int |
87 | TALER_MINT_DB_get_reserve (PGconn *db_conn, | 133 | TALER_MINT_DB_get_reserve (PGconn *db_conn, |
88 | const struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub, | 134 | const struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub, |
@@ -103,6 +149,9 @@ TALER_MINT_DB_update_reserve (PGconn *db_conn, | |||
103 | int fresh); | 149 | int fresh); |
104 | 150 | ||
105 | 151 | ||
152 | |||
153 | |||
154 | |||
106 | int | 155 | int |
107 | TALER_MINT_DB_insert_refresh_order (PGconn *db_conn, | 156 | TALER_MINT_DB_insert_refresh_order (PGconn *db_conn, |
108 | uint16_t newcoin_index, | 157 | uint16_t newcoin_index, |
@@ -115,17 +164,46 @@ TALER_MINT_DB_get_refresh_session (PGconn *db_conn, | |||
115 | struct RefreshSession *r_session); | 164 | struct RefreshSession *r_session); |
116 | 165 | ||
117 | 166 | ||
167 | |||
168 | |||
169 | /** | ||
170 | * FIXME | ||
171 | */ | ||
172 | struct KnownCoin | ||
173 | { | ||
174 | struct TALER_CoinPublicInfo public_info; | ||
175 | |||
176 | /** | ||
177 | * Refreshing session, only valid if | ||
178 | * is_refreshed==1. | ||
179 | */ | ||
180 | struct GNUNET_CRYPTO_EddsaPublicKey refresh_session_pub; | ||
181 | |||
182 | struct TALER_Amount expended_balance; | ||
183 | |||
184 | int is_refreshed; | ||
185 | |||
186 | }; | ||
187 | |||
188 | |||
118 | int | 189 | int |
119 | TALER_MINT_DB_get_known_coin (PGconn *db_conn, | 190 | TALER_MINT_DB_get_known_coin (PGconn *db_conn, |
120 | const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, | 191 | const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, |
121 | struct KnownCoin *known_coin); | 192 | struct KnownCoin *known_coin); |
122 | 193 | ||
123 | 194 | // FIXME: what does 'upsert' even mean!? | |
124 | int | 195 | int |
125 | TALER_MINT_DB_upsert_known_coin (PGconn *db_conn, | 196 | TALER_MINT_DB_upsert_known_coin (PGconn *db_conn, |
126 | struct KnownCoin *known_coin); | 197 | struct KnownCoin *known_coin); |
127 | 198 | ||
128 | 199 | ||
200 | int | ||
201 | TALER_MINT_DB_insert_known_coin (PGconn *db_conn, | ||
202 | const struct KnownCoin *known_coin); | ||
203 | |||
204 | |||
205 | |||
206 | |||
129 | 207 | ||
130 | 208 | ||
131 | int | 209 | int |
@@ -262,10 +340,6 @@ TALER_MINT_DB_get_deposit (PGconn *db_conn, | |||
262 | struct Deposit *r_deposit); | 340 | struct Deposit *r_deposit); |
263 | 341 | ||
264 | 342 | ||
265 | int | ||
266 | TALER_MINT_DB_insert_known_coin (PGconn *db_conn, | ||
267 | const struct KnownCoin *known_coin); | ||
268 | |||
269 | 343 | ||
270 | /** | 344 | /** |
271 | * Get the thread-local database-handle. | 345 | * Get the thread-local database-handle. |