InitUserIndex creates and initializes the singleton UserIndex. Called once at startup.
()
| 63 | |
| 64 | // InitUserIndex creates and initializes the singleton UserIndex. Called once at startup. |
| 65 | func InitUserIndex() *UserIndex { |
| 66 | filename := util.FilePath(string(configs.GetFilePathsConfig().DataFiles), `/`, `users`, `/`, `users.idx`) |
| 67 | userIndex = &UserIndex{Filename: filename} |
| 68 | if userIndex.Exists() { |
| 69 | userIndex.metaData = userIndex.getMetaDataFromFile() |
| 70 | userIndex.loadRecords() |
| 71 | } |
| 72 | return userIndex |
| 73 | } |
| 74 | |
| 75 | // GetUserIndex returns the singleton UserIndex, initializing it if needed. |
| 76 | func GetUserIndex() *UserIndex { |