code: func (c *InstanceCache) saveState(ctx context.Context, state *messages.InstanceCache) error {
  	stateBytes, err := MarshalWithSHA256(state)
  	if err != nil {
  		return err
  	}
  
  	statePath, err := c.fs.RootRelToAbs(instanceCacheStateFilename)
  	if err != nil {
  		panic("impossible")
  	}
  
  	return fs.EnsureFile(ctx, c.fs, statePath, bytes.NewReader(stateBytes))
  }
docs: // saveState persists the cache state.