Documentation
¶
Index ¶
- func EnhancedReadinessHandler(sharedDir string) http.HandlerFunc
- func FormatFileSize(bytes int64) string
- func FormatModTime(modTime string) string
- func HealthIndexHandler(sharedDir string) http.HandlerFunc
- func IsFile(path string) bool
- func LLMsTxtHandler(w http.ResponseWriter, r *http.Request)
- func LivenessHandler(w http.ResponseWriter, r *http.Request)
- func LogsHandler() http.HandlerFunc
- func MarkStartupReady()
- func ResolvePath(sharedDir, reqPath string) (string, error)
- func StartupHandler(w http.ResponseWriter, r *http.Request)
- func StaticHandler(w http.ResponseWriter, r *http.Request)
- func StatsHandler(w http.ResponseWriter, r *http.Request)
- type AuthHandler
- type AuthStatusResponse
- type ComponentStatus
- type CreateShareableLinkRequest
- type CreateShareableLinkResponse
- type DownloadHandler
- type File
- type FileHandler
- type FileOperationsHandler
- func (h *FileOperationsHandler) Copy(w http.ResponseWriter, r *http.Request)
- func (h *FileOperationsHandler) Mkdir(w http.ResponseWriter, r *http.Request)
- func (h *FileOperationsHandler) Move(w http.ResponseWriter, r *http.Request)
- func (h *FileOperationsHandler) Rename(w http.ResponseWriter, r *http.Request)
- func (h *FileOperationsHandler) Search(w http.ResponseWriter, r *http.Request)
- func (h *FileOperationsHandler) Star(w http.ResponseWriter, r *http.Request)
- func (h *FileOperationsHandler) Starred(w http.ResponseWriter, r *http.Request)
- func (h *FileOperationsHandler) Trash(w http.ResponseWriter, r *http.Request)
- func (h *FileOperationsHandler) Write(w http.ResponseWriter, r *http.Request)
- type HealthResponse
- type LogEntry
- type LoginRequest
- type LoginResponse
- type LogsResponse
- type MCPHandler
- type ShareableLinkHandler
- func (h *ShareableLinkHandler) Access(w http.ResponseWriter, r *http.Request)
- func (h *ShareableLinkHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *ShareableLinkHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *ShareableLinkHandler) List(w http.ResponseWriter, r *http.Request)
- type ShareableLinkInfo
- type ValidateLinkRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnhancedReadinessHandler ¶
func EnhancedReadinessHandler(sharedDir string) http.HandlerFunc
EnhancedReadinessHandler checks that the service can serve traffic: database is reachable and the shared directory is available.
GET /health/ready
func FormatFileSize ¶
FormatFileSize formats file size in human-readable format
func FormatModTime ¶
FormatModTime formats modification time
func HealthIndexHandler ¶
func HealthIndexHandler(sharedDir string) http.HandlerFunc
HealthIndexHandler responds on the base /health path with an overview of all probes, so operators can hit a single URL.
GET /health
func LLMsTxtHandler ¶ added in v0.2.7
func LLMsTxtHandler(w http.ResponseWriter, r *http.Request)
LLMsTxtHandler serves the /llms.txt file for LLM discoverability.
func LivenessHandler ¶
func LivenessHandler(w http.ResponseWriter, r *http.Request)
LivenessHandler returns 200 as long as the process is alive. This is the cheapest possible probe – no I/O.
GET /health/live
func LogsHandler ¶
func LogsHandler() http.HandlerFunc
LogsHandler returns an HTTP handler that reads and serves structured JSON logs from the beamdrop log file.
Query parameters:
- limit: max entries to return (default 200, max 5000)
- offset: number of entries to skip from the end (for pagination)
- level: filter by log level (debug, info, warn, error)
- search: case-insensitive substring match on the message field
func MarkStartupReady ¶
func MarkStartupReady()
MarkStartupReady should be called after the server has finished all initialisation steps (DB migration, orphan cleanup, etc.) and is ready to serve traffic for the first time.
func ResolvePath ¶
ResolvePath safely resolves a relative path within the shared directory
func StartupHandler ¶
func StartupHandler(w http.ResponseWriter, r *http.Request)
StartupHandler returns 200 once MarkStartupReady() has been called, 503 before that. K8s uses this to know when the container has finished initialising so it can switch to liveness/readiness probes.
GET /health/startup
func StaticHandler ¶
func StaticHandler(w http.ResponseWriter, r *http.Request)
func StatsHandler ¶
func StatsHandler(w http.ResponseWriter, r *http.Request)
Types ¶
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
AuthHandler handles authentication endpoints
func NewAuthHandler ¶
func NewAuthHandler(ps *auth.PasswordService) *AuthHandler
NewAuthHandler creates a new auth handler
func (*AuthHandler) Login ¶
func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request)
Login handles the login endpoint
func (*AuthHandler) Logout ¶
func (h *AuthHandler) Logout(w http.ResponseWriter, r *http.Request)
Logout handles the logout endpoint
func (*AuthHandler) Status ¶
func (h *AuthHandler) Status(w http.ResponseWriter, r *http.Request)
Status handles the auth status endpoint
type AuthStatusResponse ¶
type AuthStatusResponse struct {
AuthEnabled bool `json:"authEnabled"`
Authenticated bool `json:"authenticated"`
}
AuthStatusResponse represents the auth status response
type ComponentStatus ¶
type ComponentStatus struct {
Status string `json:"status"` // "ok" | "degraded" | "unavailable"
Message string `json:"message,omitempty"` // human-readable detail
Latency string `json:"latency,omitempty"` // e.g. "1.23ms"
}
ComponentStatus describes the status of a single subsystem.
type CreateShareableLinkRequest ¶
type CreateShareableLinkRequest struct {
}
CreateShareableLinkRequest represents the request to create a shareable link
type CreateShareableLinkResponse ¶
type CreateShareableLinkResponse struct {
}
CreateShareableLinkResponse represents the response after creating a shareable link
type DownloadHandler ¶ added in v0.2.0
type DownloadHandler struct {
// contains filtered or unexported fields
}
func NewDownloadHandler ¶ added in v0.2.0
func NewDownloadHandler(sharedDir string) *DownloadHandler
func (*DownloadHandler) ServeHTTP ¶ added in v0.2.0
func (h *DownloadHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type File ¶
type File struct {
Name string `json:"name"`
Size string `json:"size"`
IsDir bool `json:"isDir"`
ModTime string `json:"modTime"`
Path string `json:"path"`
IsStarred bool `json:"isStarred"`
}
File represents a file or directory in the file system
type FileHandler ¶
type FileHandler struct {
// contains filtered or unexported fields
}
func NewFileHandler ¶
func NewFileHandler(sharedDir string) *FileHandler
func (*FileHandler) Download ¶
func (h *FileHandler) Download(w http.ResponseWriter, r *http.Request)
func (*FileHandler) ListFiles ¶
func (h *FileHandler) ListFiles(w http.ResponseWriter, r *http.Request)
func (*FileHandler) Upload ¶
func (h *FileHandler) Upload(w http.ResponseWriter, r *http.Request)
type FileOperationsHandler ¶
type FileOperationsHandler struct {
// contains filtered or unexported fields
}
func NewFileOperationsHandler ¶
func NewFileOperationsHandler(sharedDir string) *FileOperationsHandler
func (*FileOperationsHandler) Copy ¶
func (h *FileOperationsHandler) Copy(w http.ResponseWriter, r *http.Request)
func (*FileOperationsHandler) Mkdir ¶
func (h *FileOperationsHandler) Mkdir(w http.ResponseWriter, r *http.Request)
func (*FileOperationsHandler) Move ¶
func (h *FileOperationsHandler) Move(w http.ResponseWriter, r *http.Request)
func (*FileOperationsHandler) Rename ¶
func (h *FileOperationsHandler) Rename(w http.ResponseWriter, r *http.Request)
func (*FileOperationsHandler) Search ¶
func (h *FileOperationsHandler) Search(w http.ResponseWriter, r *http.Request)
func (*FileOperationsHandler) Star ¶
func (h *FileOperationsHandler) Star(w http.ResponseWriter, r *http.Request)
func (*FileOperationsHandler) Starred ¶
func (h *FileOperationsHandler) Starred(w http.ResponseWriter, r *http.Request)
func (*FileOperationsHandler) Trash ¶
func (h *FileOperationsHandler) Trash(w http.ResponseWriter, r *http.Request)
func (*FileOperationsHandler) Write ¶
func (h *FileOperationsHandler) Write(w http.ResponseWriter, r *http.Request)
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"` // "healthy" | "unhealthy"
Service string `json:"service"` // always "beamdrop"
Version string `json:"version"` // build version
Timestamp string `json:"timestamp"` // RFC 3339
Components map[string]ComponentStatus `json:"components"` // per-component checks
}
HealthResponse is the envelope returned by all health endpoints.
type LogEntry ¶
type LogEntry struct {
Time string `json:"time"`
Level string `json:"level"`
Msg string `json:"msg"`
Source map[string]any `json:"source,omitempty"`
Attrs map[string]any `json:"attrs,omitempty"` // extra fields
RawJSON string `json:"-"`
}
LogEntry represents a single structured JSON log line.
type LoginRequest ¶
type LoginRequest struct {
Password string `json:"password"`
}
LoginRequest represents the login request body
type LoginResponse ¶
type LoginResponse struct {
Success bool `json:"success"`
Token string `json:"token,omitempty"`
Message string `json:"message,omitempty"`
}
LoginResponse represents the login response
type LogsResponse ¶
type LogsResponse struct {
Logs []map[string]any `json:"logs"`
Total int `json:"total"`
Returned int `json:"returned"`
HasMore bool `json:"hasMore"`
LogPath string `json:"logPath"`
}
LogsResponse is the JSON envelope returned by the /logs endpoint.
type MCPHandler ¶ added in v0.2.7
type MCPHandler struct {
// contains filtered or unexported fields
}
MCPHandler handles MCP protocol requests at /mcp. Supports Streamable HTTP transport: POST for JSON-RPC requests.
func NewMCPHandler ¶ added in v0.2.7
func NewMCPHandler(sharedDir string) *MCPHandler
NewMCPHandler creates a new MCP HTTP handler.
func (*MCPHandler) ServeHTTP ¶ added in v0.2.7
func (h *MCPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles MCP requests.
type ShareableLinkHandler ¶
type ShareableLinkHandler struct {
// contains filtered or unexported fields
}
func NewShareableLinkHandler ¶
func NewShareableLinkHandler(sharedDir string) *ShareableLinkHandler
func (*ShareableLinkHandler) Access ¶
func (h *ShareableLinkHandler) Access(w http.ResponseWriter, r *http.Request)
Access handles GET requests to access a file/folder via shareable link (public API endpoint)
func (*ShareableLinkHandler) Create ¶
func (h *ShareableLinkHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST requests to create a new shareable link
func (*ShareableLinkHandler) Delete ¶
func (h *ShareableLinkHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE requests to remove a shareable link
func (*ShareableLinkHandler) List ¶
func (h *ShareableLinkHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET requests to list all shareable links
type ShareableLinkInfo ¶
type ShareableLinkInfo struct {
}
ShareableLinkInfo represents link information without sensitive data
type ValidateLinkRequest ¶
type ValidateLinkRequest struct {
Password string `json:"password,omitempty"`
}
ValidateLinkRequest represents the request to validate a link with password