File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -313,18 +313,30 @@ func (c *Cache) CreateSnapshots(ctx context.Context, w map[uint32]io.Writer) (ui
313
313
return since , nil
314
314
}
315
315
316
- // LoadSnapshot reads the cache contents from the provided reader
317
- func (c * Cache ) LoadSnapshot (r io.Reader ) error {
316
+ // LoadSnapshots reads the cache contents from the provided readers
317
+ func (c * Cache ) LoadSnapshots (r ... io.Reader ) error {
318
318
// TODO gzip should be configurable, maybe we want to use another algorithm with a different compression level
319
319
if c .compress {
320
320
var err error
321
- r , err = gzip .NewReader (r )
322
- if err != nil {
323
- return fmt .Errorf ("failed to create gzip reader: %w" , err )
321
+ for i , rdr := range r {
322
+ r [i ], err = gzip .NewReader (rdr )
323
+ if err != nil {
324
+ return fmt .Errorf ("failed to create gzip reader: %w" , err )
325
+ }
324
326
}
325
- defer func () { _ = r .(* gzip.Reader ).Close () }()
327
+ defer func () {
328
+ for _ , rdr := range r {
329
+ err := rdr .(* gzip.Reader ).Close ()
330
+ if err != nil {
331
+ c .logger .Errorn ("failed to close gzip reader" , obskit .Error (err ))
332
+ }
333
+ }
334
+ }()
326
335
}
327
- return c .cache .Load (r , 16 )
336
+
337
+ // TODO implement custom load with KVLoader
338
+
339
+ return nil
328
340
}
329
341
330
342
func (c * Cache ) RunGarbageCollection () {
You can’t perform that action at this time.
0 commit comments