MCPcopy Create free account
hub / github.com/comerc/yandex / Get

Method Get

CHALLENGE/_viktor.go:36–55  ·  view source on GitHub ↗
(ctx context.Context, id int64)

Source from the content-addressed store, hash-verified

34}
35
36func (e *Example) Get(ctx context.Context, id int64) (*Item, error) {
37 var item Item
38 eg, egCtx := errgroup.WithContext(ctx)
39 eg.Go(func() error {
40 item, err := e.storeV1.Get(egCtx, id)
41 if err != nil {
42 return fmt.Errorf("failed to get item (id: %d) from storeV1: %w", id, err)
43 }
44
45 return nil
46 })
47 eg.Go(func() error {
48 item, err := e.storeV2.Get(egCtx, id)
49 if err != nil {
50 return fmt.Errorf("failed to get item (id: %d) from storeV2: %w", id, err)
51 }
52 })
53
54 return &item, eg.Wait()
55}
56
57func (e *Example) GetBatch(ctx context.Context, ids []int64) ([]*Item, error) {
58 // enable shadow read from new storage

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected