Index retrieves and deserializes the index from Redis.
()
| 30 | |
| 31 | // Index retrieves and deserializes the index from Redis. |
| 32 | func (s *IndexStorage) Index() (*index.Index, error) { |
| 33 | data, err := s.client.Get(ctx, withNamespace(s.namespacePrefix, indexPrefix, "")).Bytes() |
| 34 | if err != nil { |
| 35 | if err == redis.Nil { |
| 36 | return &index.Index{Version: 2}, nil |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | var idx index.Index |
| 41 | if err := json.Unmarshal(data, &idx); err != nil { |
| 42 | return nil, err |
| 43 | } |
| 44 | |
| 45 | return &idx, nil |
| 46 | } |
nothing calls this directly
no test coverage detected