MCPcopy Create free account
hub / github.com/clouditor/clouditor / NewStorage

Function NewStorage

persistence/inmemory/inmemory.go:13–18  ·  view source on GitHub ↗

NewStorage creates a new in-memory storage. For now this uses the gorm provider with the gorm.WithInMemory. In the future we want to supply our own independent implementation. It automatically sets the maximum concurrent connections to 1 because the in-memory sqlite driver has problems with more tha

()

Source from the content-addressed store, hash-verified

11// to 1 because the in-memory sqlite driver has problems with more than concurrent connection (see
12// https://github.com/mattn/go-sqlite3/issues/511).
13func NewStorage() (persistence.Storage, error) {
14 return gorm.NewStorage(
15 gorm.WithInMemory(),
16 gorm.WithMaxOpenConns(1),
17 gorm.WithLogger(logger.Default.LogMode(logger.Silent)))
18}

Callers 8

NewServiceFunction · 0.92
NewServiceFunction · 0.92
NewServiceFunction · 0.92
TestNewServiceFunction · 0.92
NewServiceFunction · 0.92
NewInMemoryStorageFunction · 0.92
initStorageMethod · 0.92
TestNewStorageFunction · 0.70

Calls 4

NewStorageFunction · 0.92
WithInMemoryFunction · 0.92
WithMaxOpenConnsFunction · 0.92
WithLoggerFunction · 0.92

Tested by 2

TestNewServiceFunction · 0.74
TestNewStorageFunction · 0.56