forked from mtusi2026/mtusi2026lab4
feat(app) implemented lab 4
This commit is contained in:
@@ -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"})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user