draincloud-core/internal/storage/interface.go

38 lines
1.1 KiB
Go
Raw Normal View History

2024-09-27 22:37:58 +00:00
package storage
import (
"context"
2024-11-23 08:52:06 +00:00
"os"
2024-09-27 22:37:58 +00:00
2024-10-10 21:36:51 +00:00
"git.optclblast.xyz/draincloud/draincloud-core/internal/storage/models"
2024-11-23 08:52:06 +00:00
auditmodels "git.optclblast.xyz/draincloud/draincloud-core/internal/storage/models/audit"
2024-09-27 22:37:58 +00:00
)
type Database interface {
AuthStorage
}
type AuthStorage interface {
2024-11-23 08:52:06 +00:00
AddUser(ctx context.Context, login string, username string, passwordHash []byte) (int64, error)
2024-09-27 22:37:58 +00:00
GetUserByLogin(ctx context.Context, login string) (*models.User, error)
GetUserByID(ctx context.Context, id uint64) (*models.User, error)
2024-11-23 08:52:06 +00:00
AddSession(ctx context.Context, ses *models.Session) (int64, error)
GetSession(ctx context.Context, sessionToken string) (*models.Session, error)
RemoveSession(ctx context.Context, id int64) error
}
type AuthAuditLogStorage interface {
AddEntry(ctx context.Context, entry auditmodels.AuditLogEntry) error
}
type MetaStorage interface {
SaveMetadata(ctx context.Context, fileType string, size int64, ext string) (int64, error)
}
type BlobStorage interface {
GetFile(ctx context.Context, id int64) (*os.File, error)
SaveBlob(ctx context.Context, id int64, data []byte) error
DeleteFile(ctx context.Context, id int64) error
2024-09-27 22:37:58 +00:00
}