MCPcopy
hub / github.com/helm/helm / Init

Function Init

pkg/storage/storage.go:333–352  ·  view source on GitHub ↗

Init initializes a new storage backend with the driver d. If d is nil, the default in-memory driver is used.

(d driver.Driver)

Source from the content-addressed store, hash-verified

331// Init initializes a new storage backend with the driver d.
332// If d is nil, the default in-memory driver is used.
333func Init(d driver.Driver) *Storage {
334 // default driver is in memory
335 if d == nil {
336 d = driver.NewMemory()
337 }
338 s := &Storage{
339 Driver: d,
340 }
341
342 var h slog.Handler
343 // Get logger from driver if it implements the LoggerSetterGetter interface
344 if ls, ok := d.(logging.LoggerSetterGetter); ok {
345 h = ls.Logger().Handler()
346 } else {
347 // If the driver does not implement the LoggerSetterGetter interface, set the default logger
348 h = slog.Default().Handler()
349 }
350 s.SetLogger(h)
351 return s
352}

Callers 15

TestHooksCleanUpFunction · 0.92
RunWithContextMethod · 0.92
InitMethod · 0.92
storageFixtureFunction · 0.92
TestStorageCreateFunction · 0.85
TestStorageUpdateFunction · 0.85
TestStorageDeleteFunction · 0.85
TestStorageListFunction · 0.85
TestStorageDeployedFunction · 0.85

Calls 3

NewMemoryFunction · 0.92
LoggerMethod · 0.65
SetLoggerMethod · 0.65

Tested by 15

TestHooksCleanUpFunction · 0.74
storageFixtureFunction · 0.74
TestStorageCreateFunction · 0.68
TestStorageUpdateFunction · 0.68
TestStorageDeleteFunction · 0.68
TestStorageListFunction · 0.68
TestStorageDeployedFunction · 0.68
TestStorageHistoryFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…