Documentation
¶
Index ¶
- Constants
- Variables
- type AccountLogic
- type CreateAccountInput
- type CreateAccountOutput
- type CreateDownloadTaskInput
- type CreateDownloadTaskOutput
- type CreateSessionInput
- type CreateSessionOutput
- type DeleteDownloadTaskInput
- type DeleteSessionInput
- type DeleteSessionOutput
- type DownloadTaskLogic
- type Downloader
- type ExecuteDownloadTaskInput
- type GetDownloadTaskFileInput
- type GetDownloadTaskFileOutput
- type GetDownloadTaskListInput
- type GetDownloadTaskListOutput
- type HashLogic
- type TokenLogic
- type UpdateDownloadTaskInput
- type UpdateDownloadTaskOutput
Constants ¶
View Source
const ( HTTPMetadataKeyContentType = "Content-Type" HTTPResponseHeaderContentType = "Content-Type" )
View Source
const (
DownloadTaskMetadataKeyFileName = "file-name"
)
Variables ¶
View Source
var ( ErrPermissionDenied = status.Error(codes.PermissionDenied, "permission denied") ErrDownloadTaskNotCompleted = status.Error(codes.FailedPrecondition, "download task not completed") )
View Source
var WireSet = wire.NewSet( NewAccountLogic, NewHashLogic, NewTokenLogic, NewDownloadTaskLogic, NewHTTPDownloader, )
Functions ¶
This section is empty.
Types ¶
type AccountLogic ¶
type AccountLogic interface { CreateAccount(ctx context.Context, in CreateAccountInput) (CreateAccountOutput, error) CreateSession(ctx context.Context, in CreateSessionInput) (CreateSessionOutput, error) DeleteSession(ctx context.Context, in DeleteSessionInput) error }
func NewAccountLogic ¶
func NewAccountLogic( database database.Database, accountDataAccessor database.AccountDataAccessor, passwordDataAccessor database.AccountPasswordDataAccessor, hashLogic HashLogic, tokenLogic TokenLogic, takenAccountNameCache cache.TakenAccountName, logger *zap.Logger, ) AccountLogic
type CreateAccountInput ¶
type CreateAccountOutput ¶
type CreateDownloadTaskInput ¶
type CreateDownloadTaskInput struct { Token string Type idm.DownloadType URL string }
type CreateDownloadTaskOutput ¶
type CreateDownloadTaskOutput struct {
DownloadTask idm.DownloadTask
}
type CreateSessionInput ¶
type CreateSessionOutput ¶
type DeleteDownloadTaskInput ¶
type DeleteSessionInput ¶
type DeleteSessionInput struct {
Token string
}
type DeleteSessionOutput ¶
type DeleteSessionOutput struct {
ExpiredToken string
}
type DownloadTaskLogic ¶
type DownloadTaskLogic interface { CreateDownloadTask(ctx context.Context, in CreateDownloadTaskInput) (CreateDownloadTaskOutput, error) GetDownloadTaskList(ctx context.Context, in GetDownloadTaskListInput) (GetDownloadTaskListOutput, error) UpdateDownloadTask(ctx context.Context, in UpdateDownloadTaskInput) (UpdateDownloadTaskOutput, error) UpdateFailedDownloadTaskStatusToPending(ctx context.Context) error DeleteDownloadTask(ctx context.Context, in DeleteDownloadTaskInput) error ExecuteDownloadTask(ctx context.Context, in ExecuteDownloadTaskInput) error ExecuteAllPendingDownloadTask(ctx context.Context) error GetDownloadTaskFile(ctx context.Context, in GetDownloadTaskFileInput) (GetDownloadTaskFileOutput, error) }
func NewDownloadTaskLogic ¶
func NewDownloadTaskLogic( tokenLogic TokenLogic, accountDataAccessor database.AccountDataAccessor, downloadTaskDataAccessor database.DownloadTaskDataAccessor, downloadTaskCreatedProducer producer.DownloadTaskCreatedProducer, fileClient file.Client, database database.Database, logger *zap.Logger, cronConfig configs.Cron, ) (DownloadTaskLogic, error)
type Downloader ¶
type Downloader interface {
Download(ctx context.Context, writer io.Writer) (map[string]any, error)
}
func NewFTPDownloader ¶
func NewFTPDownloader() (Downloader, error)
func NewHTTPDownloader ¶
func NewHTTPDownloader( url string, logger *zap.Logger, ) (Downloader, error)
type ExecuteDownloadTaskInput ¶
type ExecuteDownloadTaskInput struct {
DownloadTaskID uint64
}
type GetDownloadTaskFileOutput ¶
type GetDownloadTaskFileOutput struct {
Reader io.ReadCloser
}
type GetDownloadTaskListOutput ¶
type GetDownloadTaskListOutput struct { DownloadTaskList []*idm.DownloadTask TotalDownloadTaskCount uint64 }
type HashLogic ¶
type HashLogic interface { HashPassword(ctx context.Context, plainPassword string) (string, error) IsHashEqual(ctx context.Context, plainPassword string, hashedPassword string) (bool, error) }
func NewHashLogic ¶
func NewHashLogic() HashLogic
type TokenLogic ¶
type TokenLogic interface { CreateTokenString(ctx context.Context, accountID uint64) (string, time.Time, error) GetAccountIDAndExpireTime(ctx context.Context, token string) (uint64, time.Time, error) WithDatabase(database database.Database) TokenLogic }
func NewTokenLogic ¶
func NewTokenLogic( accountDataAccessor database.AccountDataAccessor, tokenPublicKeyDataAccessor database.TokenPublicKeyDataAccessor, logger *zap.Logger, authConfig configs.Auth, tokenPublicKeyCache cache.TokenPublicKey, ) (TokenLogic, error)
type UpdateDownloadTaskInput ¶
type UpdateDownloadTaskOutput ¶
type UpdateDownloadTaskOutput struct {
DownloadTask idm.DownloadTask
}
Click to show internal directories.
Click to hide internal directories.