KeepAlive implements blobcache.HandleAPI.KeepAlive
(_ context.Context, hs []blobcache.Handle)
| 366 | |
| 367 | // KeepAlive implements blobcache.HandleAPI.KeepAlive |
| 368 | func (sys *System) KeepAlive(_ context.Context, hs []blobcache.Handle) error { |
| 369 | for _, h := range hs { |
| 370 | if _, rights := sys.handles.Resolve(h); rights == 0 { |
| 371 | return blobcache.ErrInvalidHandle{Handle: h} |
| 372 | } |
| 373 | |
| 374 | var ttl time.Duration |
| 375 | sys.mu.RLock() |
| 376 | if _, ok := sys.volumes[h.OID]; ok { |
| 377 | ttl = DefaultVolumeTTL |
| 378 | } |
| 379 | if _, ok := sys.txns[h.OID]; ok { |
| 380 | ttl = DefaultTxTTL |
| 381 | } |
| 382 | if _, ok := sys.queues[h.OID]; ok { |
| 383 | ttl = DefaultQueueTTL |
| 384 | } |
| 385 | sys.mu.RUnlock() |
| 386 | |
| 387 | sys.handles.KeepAlive(h, time.Now().Add(ttl)) |
| 388 | } |
| 389 | return nil |
| 390 | } |
| 391 | |
| 392 | // InspectHandle implements blobcache.HandleAPI.InspectHandle |
| 393 | func (sys *System) InspectHandle(_ context.Context, h blobcache.Handle) (*blobcache.HandleInfo, error) { |