Zanzana: Use StreamedListObjects to fetch full list of resources (#97025)

* Initial streamed version of list

* instantiate openfga client to use StreamedListObjects

* Add config option for using streamed version

* Use caching

* fix cache init

* Fix hashing

* refactor
This commit is contained in:
Alexander Zobnin
2024-11-27 14:05:41 +02:00
committed by GitHub
parent 3957b0b26a
commit 5a91ab46af
5 changed files with 136 additions and 10 deletions
+4
View File
@@ -34,6 +34,9 @@ type ZanzanaSettings struct {
ListObjectsMaxResults uint32
// Deadline for the ListObjects() query. Default is 3 seconds.
ListObjectsDeadline time.Duration
// Use streamed version of list objects.
// Returns full list of objects, but takes more time.
UseStreamedListObjects bool
}
func (cfg *Cfg) readZanzanaSettings() {
@@ -58,6 +61,7 @@ func (cfg *Cfg) readZanzanaSettings() {
s.CheckQueryCacheTTL = sec.Key("check_query_cache_ttl").MustDuration(10 * time.Second)
s.ListObjectsDeadline = sec.Key("list_objects_deadline").MustDuration(3 * time.Second)
s.ListObjectsMaxResults = uint32(sec.Key("list_objects_max_results").MustUint(1000))
s.UseStreamedListObjects = sec.Key("use_streamed_list_objects").MustBool(false)
cfg.Zanzana = s
}