MCPcopy Create free account
hub / github.com/donatj/sqlread / Store

Method Store

mapcache/cache.go:58–77  ·  view source on GitHub ↗
(s sqlread.SummaryTree)

Source from the content-addressed store, hash-verified

56}
57
58func (m *MapCache) Store(s sqlread.SummaryTree) error {
59 cf, err := os.OpenFile(m.getCacheFile(), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
60 defer cf.Close()
61 if err != nil {
62 return err
63 }
64
65 e := json.NewEncoder(cf)
66 err = e.Encode(cacheInfo{
67 Version: CacheVersion,
68 FileSize: m.getFileSize(),
69 Tree: s,
70 })
71
72 if err != nil {
73 return err
74 }
75
76 return nil
77}
78
79func (m *MapCache) getCacheFile() string {
80 return m.sqlfile.Name() + ".sqlmap"

Callers 1

mainFunction · 0.80

Calls 2

getCacheFileMethod · 0.95
getFileSizeMethod · 0.95

Tested by

no test coverage detected