MCPcopy
hub / github.com/wavetermdev/waveterm / WriteMeta

Method WriteMeta

pkg/filestore/blockstore.go:206–226  ·  view source on GitHub ↗
(ctx context.Context, zoneId string, name string, meta wshrpc.FileMeta, merge bool)

Source from the content-addressed store, hash-verified

204}
205
206func (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
228func (s *FileStore) WriteFile(ctx context.Context, zoneId string, name string, data []byte) error {
229 return withLock(s, zoneId, name, func(entry *CacheEntry) error {

Callers 3

SaveTerminalStateMethod · 0.80
restartStreamingFunction · 0.80
TestSetMetaFunction · 0.80

Calls 2

withLockFunction · 0.85
loadFileIntoCacheMethod · 0.80

Tested by 1

TestSetMetaFunction · 0.64