(ctx context.Context, node *tree.Node)
| 151 | } |
| 152 | |
| 153 | func (s *CacheHandler) cacheAdd(ctx context.Context, node *tree.Node) { |
| 154 | d, _ := json.Marshal(node) |
| 155 | log.Logger(ctx).Debug("Storing node to cache", node.Zap()) |
| 156 | _ = s.getCtxCache(ctx).Set(cacheNodePrefix+node.GetPath(), d) |
| 157 | // Update diff |
| 158 | diff := NewCacheDiff() |
| 159 | dir := path.Dir(node.GetPath()) |
| 160 | if diffDat, ok := s.getCtxCache(ctx).GetBytes(cacheDiffPrefix + dir); ok { |
| 161 | json.Unmarshal(diffDat, &diff) |
| 162 | } |
| 163 | diff.Adds[node.GetPath()] = struct{}{} |
| 164 | delete(diff.Deletes, node.GetPath()) |
| 165 | diffDat, _ := json.Marshal(diff) |
| 166 | _ = s.getCtxCache(ctx).Set(cacheDiffPrefix+dir, diffDat) |
| 167 | } |
| 168 | |
| 169 | func (s *CacheHandler) cacheDel(ctx context.Context, node *tree.Node) { |
| 170 | // Update diff |
no test coverage detected