claude-code-proxy/proxy/internal/service/storage.go

33 lines
956 B
Go

package service
import (
"io"
"time"
"github.com/seifghazi/claude-code-monitor/internal/config"
"github.com/seifghazi/claude-code-monitor/internal/model"
)
type StorageService interface {
// Core CRUD operations
SaveRequest(request *model.RequestLog) (string, error)
GetRequests(page, limit int, modelFilter string) ([]model.RequestLog, int, error)
GetAllRequests(modelFilter string) ([]*model.RequestLog, error)
GetRequestByShortID(shortID string) (*model.RequestLog, string, error)
ClearRequests() (int, error)
// Update operations
UpdateRequestWithGrading(requestID string, grade *model.PromptGrade) error
UpdateRequestWithResponse(request *model.RequestLog) error
// Maintenance operations
DeleteRequestsOlderThan(age time.Duration) (int, error)
GetDatabaseStats() (map[string]interface{}, error)
// Configuration
GetConfig() *config.StorageConfig
EnsureDirectoryExists() error
// Cleanup - implements io.Closer
io.Closer
}