mirror of
https://github.com/pikami/cosmium.git
synced 2025-03-14 05:46:27 +00:00
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
|
package mapdatastore
|
||
|
|
||
|
import "github.com/pikami/cosmium/internal/datastore"
|
||
|
|
||
|
type MapDataStore struct {
|
||
|
storeState State
|
||
|
|
||
|
initialDataFilePath string
|
||
|
persistDataFilePath string
|
||
|
}
|
||
|
|
||
|
type MapDataStoreOptions struct {
|
||
|
InitialDataFilePath string
|
||
|
PersistDataFilePath string
|
||
|
}
|
||
|
|
||
|
func NewMapDataStore(options MapDataStoreOptions) *MapDataStore {
|
||
|
dataStore := &MapDataStore{
|
||
|
storeState: State{
|
||
|
Databases: make(map[string]datastore.Database),
|
||
|
Collections: make(map[string]map[string]datastore.Collection),
|
||
|
Documents: make(map[string]map[string]map[string]datastore.Document),
|
||
|
Triggers: make(map[string]map[string]map[string]datastore.Trigger),
|
||
|
StoredProcedures: make(map[string]map[string]map[string]datastore.StoredProcedure),
|
||
|
UserDefinedFunctions: make(map[string]map[string]map[string]datastore.UserDefinedFunction),
|
||
|
},
|
||
|
initialDataFilePath: options.InitialDataFilePath,
|
||
|
persistDataFilePath: options.PersistDataFilePath,
|
||
|
}
|
||
|
|
||
|
dataStore.InitializeDataStore()
|
||
|
|
||
|
return dataStore
|
||
|
}
|