Restart Init

This commit is contained in:
Simon Martens
2026-02-18 13:41:44 +01:00
parent 938cdeb27b
commit 4f4288905d
2955 changed files with 4795 additions and 53375 deletions

35
app/app.go Normal file
View File

@@ -0,0 +1,35 @@
package app
import (
"sync"
"sync/atomic"
gitpkg "github.com/Theodor-Springmann-Stiftung/lenz-web/git"
"github.com/Theodor-Springmann-Stiftung/lenz-web/xmlmodels"
)
type App struct {
mu sync.Mutex
lib atomic.Pointer[xmlmodels.Library]
}
func New() *App {
return &App{}
}
func (a *App) Library() *xmlmodels.Library {
return a.lib.Load()
}
func (a *App) RefreshLibrary(dir string, commit *gitpkg.Commit) (*xmlmodels.Library, error) {
a.mu.Lock()
defer a.mu.Unlock()
lib, err := xmlmodels.Parse(dir, commit)
if err != nil {
return nil, err
}
a.lib.Store(lib)
return lib, nil
}