MCPcopy Create free account
hub / github.com/brimdata/super / Fetch

Method Fetch

runtime/vcache/cache.go:50–73  ·  view source on GitHub ↗
(ctx context.Context, uri *storage.URI, id ksuid.KSUID)

Source from the content-addressed store, hash-verified

48}
49
50func (c *Cache) Fetch(ctx context.Context, uri *storage.URI, id ksuid.KSUID) (*Object, error) {
51 c.mu.Lock()
52 object, ok := c.objects[id]
53 c.mu.Unlock()
54 if ok {
55 return object, nil
56 }
57 c.lock(id)
58 defer c.unlock(id)
59 c.mu.Lock()
60 object, ok = c.objects[id]
61 c.mu.Unlock()
62 if ok {
63 return object, nil
64 }
65 object, err := NewObject(ctx, c.engine, uri)
66 if err != nil {
67 return nil, err
68 }
69 c.mu.Lock()
70 c.objects[id] = object
71 c.mu.Unlock()
72 return object, nil
73}

Callers 6

RunMethod · 0.95
PullMethod · 0.45
runMethod · 0.45
runMethod · 0.45
ReadMethod · 0.45
ConcurrentPullMethod · 0.45

Calls 3

lockMethod · 0.95
unlockMethod · 0.95
NewObjectFunction · 0.70

Tested by

no test coverage detected