benoitdm-oslandia / pg_featureserv

Apache License 2.0
1 stars 0 forks source link

feat(catalog): Etag cache implementation into catalog - [merged] #124

Closed benoitdm-oslandia closed 1 year ago

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 14, 2022, 16:24

_Merges feat/catalogcache -> develop

close #51

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 14, 2022, 16:49

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 14, 2022, 16:51

marked this merge request as ready

benoitdm-oslandia commented 1 year ago

Au dessus des imports stp

benoitdm-oslandia commented 1 year ago

les fonctions ne semblent pas être testée

benoitdm-oslandia commented 1 year ago

supprimer les log.Info

benoitdm-oslandia commented 1 year ago

Avant les imports

benoitdm-oslandia commented 1 year ago

supprimer le code mort (partout)

benoitdm-oslandia commented 1 year ago

avant les imports

benoitdm-oslandia commented 1 year ago

devrait être au moins une constante, au mieux un paramètre de la conf

benoitdm-oslandia commented 1 year ago

Je crois me souvenir qu'on avait dit que l'eTag serait un membre de la struct api.GeojsonFeatureData ?

benoitdm-oslandia commented 1 year ago

Dans quel cas penses tu que cette fonction sera utilisée ?

benoitdm-oslandia commented 1 year ago

est ce que cette fonction ne pourrait pas être une fonction outil dans cache.go ?

benoitdm-oslandia commented 1 year ago

idem est ce que la comparaison de 2 strong etag ne pourrait pas être une fonction outil dans cache.go ?

benoitdm-oslandia commented 1 year ago

a priori les headers ont toujours le même format et n'ont pas suivre les formats définis par le "Accept". Le header "Accept" n'est que pour le body.

benoitdm-oslandia commented 1 year ago

je n'ai pas vérifié, mais si le header If-None-Match ou If-Match est mal écrit on doit vraiment retourner un BadRequest ??

benoitdm-oslandia commented 1 year ago

Une dernière chose : si tu ne modifies pas le code d'un fichier, inutile de modifier juste la date du header (2019 --> 2022) ! Pourrais tu revert les fichiers modifiés dont tu as juste mis à jour la date du header stp ?

benoitdm-oslandia commented 1 year ago

marked this merge request as draft

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 17, 2022, 11:48

Commented on internal/data/cache_active.go line 17

ok

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 17, 2022, 11:55

Commented on internal/service/db_test/handler_db_etag_test.go line 53

Tu parles de la vérification du fait qu'un etag strong est en Base64 ? Ici dans le test c'est peut-être mal nommé, car je vérifie au départ simplement l'encodage. Tu verrais une route dédiée au niveau de l'API pour vérifier un strong etag directement dans sa forme brute (base64) ?

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 17, 2022, 11:56

Commented on internal/service/db_test/handler_db_etag_test.go line 120

Oui mais si le client réclame un format différent, on parle alors de représenation différente de la feature, et on parle donc de strong etag différent non ?

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 17, 2022, 12:05

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 17, 2022, 12:15

Commented on internal/service/db_test/handler_db_etag_test.go line 171

J'ai l'impression qu'on pourrait traiter la requête en l'état. Mais ça engendrerait de la charge un peu inutile côté serveur /base non ? Comment trancher ?

benoitdm-oslandia commented 1 year ago

actuellement notre strong etag ne prend pas en compte le format requis par le client. C'est une information transmise sous la forme d'un header HTTP

benoitdm-oslandia commented 1 year ago

Non je voulais dire que le processus qui prend en entrée une string (strong etag) et qui produit les différents élément du strong etag (incluant le weak) pourrait être une fonction dans cache.go

benoitdm-oslandia commented 1 year ago

Selon la RFC, il faut répondre par un 412 :

An origin server MUST NOT perform the requested method if a received If-Match condition evaluates to false; instead, the origin server MUST respond with either a) the 412 (Precondition Failed) status code

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 17, 2022, 14:02

Commented on internal/service/db_test/handler_db_etag_test.go line 171

J'ai l'impression dans la RFC 7232 que les réponses 412 seraient pour les requêtes conditionnées du type POST,PUT,DELETE, et 304 pour les GET/HEAD ?

https://www.rfc-editor.org/rfc/rfc7232.html#section-2.3 :

When If-None-Match is present, evaluate the If-None-Match
       precondition:

       *  if true, continue to step 5

       *  if false for GET/HEAD, respond 304 (Not Modified)

       *  if false for other methods, respond 412 (Precondition Failed)
benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 17, 2022, 14:03

Normalement c'est ok, et le commit concerné de ce amtin poussé.

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 18, 2022, 09:58

Commented on internal/service/db_test/handler_db_etag_test.go line 120

Pour bien confirmer, actuellement la construction du strong etag a été décidée et implémentée de cette façon : <collection>-<srid>-<format>-<weakEtag> Est-ce qu'il faut en changer ?

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 18, 2022, 10:01

Commented on internal/data/catalog.go line 81

Cette forme était due au fait que FunctionFeature renvoyait 3 elements (dont l'etag de la feature). Désormais l'etag intègre la structure api.GeojsonFeatureData. Donc je pense que la question n'a plus lieu d'être ?

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 18, 2022, 10:01

Commented on internal/data/catalog.go line 52

Fait, je vais pousser cette modif

benoitdm-oslandia commented 1 year ago

non c'est bon !

benoitdm-oslandia commented 1 year ago

ok pour POST,PUT,DELETE ==> 304 et GET/HEAD ==> 412

benoitdm-oslandia commented 1 year ago

c'est bon !

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 18, 2022, 14:32

Commented on internal/service/db_test/handler_db_etag_test.go line 171

Ok, tu voulais bien dire l'inverse c'est ça ? POST,PUT,DELETE ==> 412 GET/HEAD ==> 304

benoitdm-oslandia commented 1 year ago

oui !

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 18, 2022, 16:50

Commented on internal/service/db_test/handler_db_etag_test.go line 171

400 Bad Request en cas d'Etag malformé

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 18, 2022, 17:17

Commented on internal/data/cache_active.go line 35

Les deux focntions d'encodage ne sont pas encore testées, mais le seront une fois la route permettant d'extraire les éléments du string etag sera en place.

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 14:36

Commented on internal/data/cache_active.go line 36

changed this line in version 4 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 14:36

Commented on internal/data/cache_passive.go line 38

changed this line in version 4 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 14:36

Commented on internal/data/catalog_db.go line 84

changed this line in version 4 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 14:36

Commented on internal/data/catalog.go line 52

changed this line in version 4 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 14:36

Commented on internal/service/db_test/handler_db_etag_test.go line 53

changed this line in version 4 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 14:36

Commented on internal/service/db_test/handler_db_etag_test.go line 84

changed this line in version 4 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 14:36

Commented on internal/service/db_test/handler_db_etag_test.go line 120

changed this line in version 4 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 14:36

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 14:38

Commented on internal/data/catalog_db.go line 84

implémenté avec prise en compte de la valeur de la variable d'envioronnement PGFS_CACHESIZE (nombre d'entrées), en complément de PGFS_CACHE dédié à l'activation du cache.

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 14:38

resolved all threads

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 15:00

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @nrevelant on Oct 19, 2022, 17:41

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

marked this merge request as ready