comparison pkg/octree/cache.go @ 1131:2e6b47cdb2ca

Store octrees along with sounding results The extra table with 1:1-relation to sounding results was a provisorial solution with the intention to make it easily removable.
author Tom Gottfried <tom@intevation.de>
date Wed, 07 Nov 2018 17:54:50 +0100
parents a244b18cb916
children 19a04b150b6c
comparison
equal deleted inserted replaced
1130:42617bba8709 1131:2e6b47cdb2ca
43 maxCacheEntries = 4 43 maxCacheEntries = 4
44 ) 44 )
45 45
46 const ( 46 const (
47 fetchOctreeSQL = ` 47 fetchOctreeSQL = `
48 SELECT checksum, octree_index 48 SELECT octree_checksum, octree_index
49 FROM waterway.octrees ot 49 FROM waterway.sounding_results
50 JOIN waterway.sounding_results sr ON ot.sounding_result_id = sr.id 50 WHERE bottleneck_id = $1 AND date_info = $2::date
51 WHERE sr.bottleneck_id = $1 AND sr.date_info = $2::date 51 AND octree_checksum NOT NULL AND octree_index NOT NULL
52 ` 52 `
53 checkOctreeSQL = ` 53 checkOctreeSQL = `
54 SELECT CASE 54 SELECT CASE
55 WHEN checksum = $3 THEN NULL 55 WHEN octree_checksum = $3 THEN NULL
56 ELSE ot.octree_index 56 ELSE octree_index
57 END 57 END
58 FROM waterway.octrees ot 58 FROM waterway.sounding_results
59 JOIN waterway.sounding_results sr ON ot.sounding_result_id = sr.id 59 WHERE bottleneck_id = $1 AND date_info = $2::date
60 WHERE sr.bottleneck_id = $1 AND sr.date_info = $2::date 60 AND octree_checksum NOT NULL AND octree_index NOT NULL
61 ` 61 `
62 ) 62 )
63 63
64 var Cache = OctreeCache{ 64 var Cache = OctreeCache{
65 entries: map[cacheKey]*cacheEntry{}, 65 entries: map[cacheKey]*cacheEntry{},