feat(app) implemented lab 4

This commit is contained in:
imadev
2026-11-06 19:06:21 +03:00
parent 68968c4a3a
commit b4239f8cf0
63 changed files with 3944 additions and 137 deletions
+9 -2
View File
@@ -6,6 +6,7 @@ import (
"sync/atomic"
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/common"
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/objectstore"
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/session"
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/store"
"github.com/gofiber/fiber/v3"
@@ -14,10 +15,11 @@ import (
type Handler struct {
store *store.Store
sessions *session.Store
objects *objectstore.Client
}
func NewHandler(st *store.Store, sessions *session.Store) *Handler {
return &Handler{store: st, sessions: sessions}
func NewHandler(st *store.Store, sessions *session.Store, objects *objectstore.Client) *Handler {
return &Handler{store: st, sessions: sessions, objects: objects}
}
var shuttingDown atomic.Bool
@@ -50,5 +52,10 @@ func (h *Handler) Ready(c fiber.Ctx) error {
common.ErrorCodeUnavailable, "session store unavailable")
}
if err := h.objects.Ping(c.Context()); err != nil {
return common.SendError(c, fiber.StatusServiceUnavailable,
common.ErrorCodeUnavailable, "object storage unavailable")
}
return c.JSON(Status{Status: "ok"})
}