MCPcopy Index your code
hub / github.com/OpenListTeam/OpenList / LoadStorage

Function LoadStorage

internal/op/storage.go:75–89  ·  view source on GitHub ↗

LoadStorage load exist storage in db to memory

(ctx context.Context, storage model.Storage)

Source from the content-addressed store, hash-verified

73
74// LoadStorage load exist storage in db to memory
75func LoadStorage(ctx context.Context, storage model.Storage) error {
76 storage.MountPath = utils.FixAndCleanPath(storage.MountPath)
77 // check driver first
78 driverName := storage.Driver
79 driverNew, err := GetDriver(driverName)
80 if err != nil {
81 return errors.WithMessage(err, "failed get driver new")
82 }
83 storageDriver := driverNew()
84
85 err = initStorage(ctx, storage, storageDriver)
86 go callStorageHooks("add", storageDriver)
87 log.Debugf("storage %+v is created", storageDriver)
88 return err
89}
90
91func getCurrentGoroutineStack() string {
92 buf := make([]byte, 1<<16)

Callers 3

LoadStoragesFunction · 0.92
LoadAllStoragesFunction · 0.92
EnableStorageFunction · 0.85

Calls 4

FixAndCleanPathFunction · 0.92
GetDriverFunction · 0.85
initStorageFunction · 0.85
callStorageHooksFunction · 0.85

Tested by

no test coverage detected