| 204 | } |
| 205 | |
| 206 | func (s *FileStore) WriteMeta(ctx context.Context, zoneId string, name string, meta wshrpc.FileMeta, merge bool) error { |
| 207 | return withLock(s, zoneId, name, func(entry *CacheEntry) error { |
| 208 | err := entry.loadFileIntoCache(ctx) |
| 209 | if err != nil { |
| 210 | return err |
| 211 | } |
| 212 | if merge { |
| 213 | for k, v := range meta { |
| 214 | if v == nil { |
| 215 | delete(entry.File.Meta, k) |
| 216 | continue |
| 217 | } |
| 218 | entry.File.Meta[k] = v |
| 219 | } |
| 220 | } else { |
| 221 | entry.File.Meta = meta |
| 222 | } |
| 223 | entry.File.ModTs = time.Now().UnixMilli() |
| 224 | return nil |
| 225 | }) |
| 226 | } |
| 227 | |
| 228 | func (s *FileStore) WriteFile(ctx context.Context, zoneId string, name string, data []byte) error { |
| 229 | return withLock(s, zoneId, name, func(entry *CacheEntry) error { |