MCPcopy Index your code
hub / github.com/dearcode/candy / get

Method get

store/file.go:183–206  ·  view source on GitHub ↗
(key []byte)

Source from the content-addressed store, hash-verified

181}
182
183func (f *fileDB) get(key []byte) (data []byte, err error) {
184 var file *os.File
185 var i fileInfo
186
187 if data, err = f.db.Get(key, nil); err != nil {
188 return
189 }
190
191 if err = json.Unmarshal(data, &i); err != nil {
192 return
193 }
194
195 f.Lock()
196 defer f.Unlock()
197
198 if file, err = f.open(i.Name); err != nil {
199 return
200 }
201
202 data = make([]byte, i.Size)
203
204 _, err = file.ReadAt(data, int64(i.Offset))
205 return
206}
207
208func (f *fileDB) exist(key []byte) (bool, error) {
209 return f.db.Has(key, nil)

Callers 7

LoadFriendListMethod · 0.45
DownloadFileMethod · 0.45
LoadMessageMethod · 0.45
LoadGroupListMethod · 0.45
TestFileDBFunction · 0.45
TestMessageDBFunction · 0.45
sendToGroupMethod · 0.45

Calls 1

openMethod · 0.95

Tested by 2

TestFileDBFunction · 0.36
TestMessageDBFunction · 0.36