MCPcopy Index your code
hub / github.com/CodisLabs/codis / Create

Method Create

pkg/models/fs/fsclient.go:179–198  ·  view source on GitHub ↗
(path string, data []byte)

Source from the content-addressed store, hash-verified

177}
178
179func (c *Client) Create(path string, data []byte) error {
180 c.Lock()
181 defer c.Unlock()
182 if c.closed {
183 return errors.Trace(ErrClosedClient)
184 }
185
186 if err := c.lockFs(); err != nil {
187 return err
188 }
189 defer c.unlockFs()
190
191 if err := c.writeFile(c.realpath(path), data, true); err != nil {
192 log.Warnf("fsclient - create %s failed", path)
193 return err
194 } else {
195 log.Infof("fsclient - create %s OK", path)
196 return nil
197 }
198}
199
200func (c *Client) Update(path string, data []byte) error {
201 c.Lock()

Callers

nothing calls this directly

Calls 6

lockFsMethod · 0.95
unlockFsMethod · 0.95
writeFileMethod · 0.95
realpathMethod · 0.95
WarnfMethod · 0.80
InfofMethod · 0.80

Tested by

no test coverage detected