MCPcopy Create free account
hub / github.com/blobcache/blobcache / KeepAlive

Method KeepAlive

src/bccore/bccore.go:368–390  ·  view source on GitHub ↗

KeepAlive implements blobcache.HandleAPI.KeepAlive

(_ context.Context, hs []blobcache.Handle)

Source from the content-addressed store, hash-verified

366
367// KeepAlive implements blobcache.HandleAPI.KeepAlive
368func (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
393func (sys *System) InspectHandle(_ context.Context, h blobcache.Handle) (*blobcache.HandleInfo, error) {

Callers

nothing calls this directly

Calls 3

KeepAliveMethod · 0.65
AddMethod · 0.65
ResolveMethod · 0.45

Tested by

no test coverage detected