MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / DefaultStore

Function DefaultStore

internal/utils/kvstore/store.go:121–144  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119var defaultSore *Store
120
121func DefaultStore() (*Store, error) {
122 if defaultSore != nil {
123 return defaultSore, nil
124 }
125
126 var resultErr error
127 storeOnce.Do(func() {
128 store, err := NewStore("default")
129 if err != nil {
130 resultErr = fmt.Errorf("create default store failed: %w", err)
131 remotelogs.Error("KV", resultErr.Error())
132 return
133 }
134 err = store.Open()
135 if err != nil {
136 resultErr = fmt.Errorf("open default store failed: %w", err)
137 remotelogs.Error("KV", resultErr.Error())
138 return
139 }
140 defaultSore = store
141 })
142
143 return defaultSore, resultErr
144}
145
146func (this *Store) Path() string {
147 return this.path

Callers 6

TestStore_DefaultFunction · 0.92
InitMethod · 0.92
InitMethod · 0.92
initMethod · 0.92
InitMethod · 0.92

Calls 6

OpenMethod · 0.95
ErrorFunction · 0.92
NewStoreFunction · 0.85
DoMethod · 0.80
ErrorfMethod · 0.80
ErrorMethod · 0.45

Tested by 2

TestStore_DefaultFunction · 0.74