Documentation ¶
Index ¶
Constants ¶
View Source
const ( LogDisabled int = iota LogDebug LogInfo LogError LogCritical )
Variables ¶
View Source
var ( ErrTooManyRequests = &domainError{ outerError: outerError{ StatusCode: http.StatusTooManyRequests, AppCode: 0x1, UserMsg: "too many requests", }, innerError: innerError{ Level: LogDebug, DevMsg: "too many requests", }, } ErrBodyTooLarge = &domainError{ outerError: outerError{ StatusCode: http.StatusRequestEntityTooLarge, AppCode: 0x2, UserMsg: "body too large", }, innerError: innerError{ Level: LogDebug, DevMsg: "body too large", }, } ErrWrongContentType = &domainError{ outerError: outerError{ StatusCode: http.StatusUnsupportedMediaType, AppCode: 0x3, UserMsg: "unsupported media type", }, innerError: innerError{ Level: LogDebug, DevMsg: "wrong content type", }, } ErrNotEnoughImages = &domainError{ outerError: outerError{ StatusCode: http.StatusBadRequest, AppCode: 0x4, UserMsg: "not enough images", }, innerError: innerError{ Level: LogDebug, DevMsg: "not enough images", }, } ErrTooManyImages = &domainError{ outerError: outerError{ StatusCode: http.StatusRequestEntityTooLarge, AppCode: 0x5, UserMsg: "too many images", }, innerError: innerError{ Level: LogDebug, DevMsg: "too many images", }, } ErrImageTooLarge = &domainError{ outerError: outerError{ StatusCode: http.StatusRequestEntityTooLarge, AppCode: 0x6, UserMsg: "image too large", }, innerError: innerError{ Level: LogDebug, DevMsg: "image too large", }, } ErrNotImage = &domainError{ outerError: outerError{ StatusCode: http.StatusUnsupportedMediaType, AppCode: 0x7, UserMsg: "unsupported media type", }, innerError: innerError{ Level: LogDebug, DevMsg: "not an image", }, } ErrDurationNotSet = &domainError{ outerError: outerError{ StatusCode: http.StatusBadRequest, AppCode: 0x8, UserMsg: "duration not set", }, innerError: innerError{ Level: LogDebug, DevMsg: "duration not set", }, } ErrDurationInvalid = &domainError{ outerError: outerError{ StatusCode: http.StatusBadRequest, AppCode: 0x9, UserMsg: "duration invalid", }, innerError: innerError{ Level: LogDebug, DevMsg: "duration invalid", }, } ErrInvalidId = &domainError{ outerError: outerError{ StatusCode: http.StatusBadRequest, AppCode: 0x17, UserMsg: "id invalid", }, innerError: innerError{ Level: LogDebug, DevMsg: "id invalid", }, } ErrAlbumNotFound = &domainError{ outerError: outerError{ StatusCode: http.StatusNotFound, AppCode: 0xA, UserMsg: "album not found", }, innerError: innerError{ Level: LogDebug, DevMsg: "album not found", }, } ErrPairNotFound = &domainError{ outerError: outerError{ StatusCode: http.StatusInternalServerError, AppCode: 0xB, UserMsg: "internal server error", }, innerError: innerError{ Level: LogError, DevMsg: "pair not found", }, } ErrTokenNotFound = &domainError{ outerError: outerError{ StatusCode: http.StatusNotFound, AppCode: 0xC, UserMsg: "token not found", }, innerError: innerError{ Level: LogDebug, DevMsg: "token not found", }, } ErrImageNotFound = &domainError{ outerError: outerError{ StatusCode: http.StatusInternalServerError, AppCode: 0xD, UserMsg: "internal server error", }, innerError: innerError{ Level: LogError, DevMsg: "image not found", }, } ErrAlbumAlreadyExists = &domainError{ outerError: outerError{ StatusCode: http.StatusInternalServerError, AppCode: 0xE, UserMsg: "internal server error", }, innerError: innerError{ Level: LogError, DevMsg: "album already exists", }, } ErrTokenAlreadyExists = &domainError{ outerError: outerError{ StatusCode: http.StatusInternalServerError, AppCode: 0xF, UserMsg: "internal server error", }, innerError: innerError{ Level: LogError, DevMsg: "token already exists", }, } ErrUnsupportedMediaType = &domainError{ outerError: outerError{ StatusCode: http.StatusUnsupportedMediaType, AppCode: 0x10, UserMsg: "unsupported media type", }, innerError: innerError{ Level: LogError, DevMsg: "image rejected by third party", }, } outerError: outerError{ StatusCode: http.StatusInternalServerError, AppCode: 0x11, UserMsg: "internal server error", }, innerError: innerError{ Level: LogCritical, DevMsg: "third party is unavailable", }, } ErrBadHealthCompressor = &domainError{ outerError: outerError{ StatusCode: http.StatusInternalServerError, AppCode: 0x12, UserMsg: "internal server error", }, innerError: innerError{ Level: LogCritical, DevMsg: "compressor is unavailable", }, } ErrBadHealthStorage = &domainError{ outerError: outerError{ StatusCode: http.StatusInternalServerError, AppCode: 0x13, UserMsg: "internal server error", }, innerError: innerError{ Level: LogCritical, DevMsg: "storage is unavailable", }, } ErrBadHealthDatabase = &domainError{ outerError: outerError{ StatusCode: http.StatusInternalServerError, AppCode: 0x14, UserMsg: "internal server error", }, innerError: innerError{ Level: LogCritical, DevMsg: "database is unavailable", }, } ErrBadHealthCache = &domainError{ outerError: outerError{ StatusCode: http.StatusInternalServerError, AppCode: 0x15, UserMsg: "internal server error", }, innerError: innerError{ Level: LogCritical, DevMsg: "cache is unavailable", }, } ErrUnknown = &domainError{ outerError: outerError{ StatusCode: http.StatusInternalServerError, AppCode: 0x16, UserMsg: "internal server error", }, innerError: innerError{ Level: LogError, DevMsg: "unknown", }, } )
Functions ¶
Types ¶
type Compresser ¶
type Databaser ¶
type Databaser interface { SaveAlbum(ctx context.Context, alb model.Album) error CountImages(ctx context.Context, album uint64) (int, error) CountImagesCompressed(ctx context.Context, album uint64) (int, error) UpdateCompressionStatus(ctx context.Context, album uint64, image uint64) error GetImageSrc(ctx context.Context, album uint64, image uint64) (string, error) GetImagesIds(ctx context.Context, album uint64) ([]uint64, error) SaveVote(ctx context.Context, album uint64, imageFrom uint64, imageTo uint64) error GetEdges(ctx context.Context, album uint64) (map[uint64]map[uint64]int, error) UpdateRatings(ctx context.Context, album uint64, vector map[uint64]float64) error GetImagesOrdered(ctx context.Context, album uint64) ([]model.Image, error) DeleteAlbum(ctx context.Context, album uint64) error AlbumsToBeDeleted(ctx context.Context) ([]model.Album, error) Checker }
type Servicer ¶
type Servicer interface { Album(ctx context.Context, ff []model.File, dur time.Duration) (uint64, error) Pair(ctx context.Context, album uint64) (model.Image, model.Image, error) Image(ctx context.Context, token uint64) (model.File, error) Vote(ctx context.Context, album uint64, tokenFrom uint64, tokenTo uint64) error Top(ctx context.Context, album uint64) ([]model.Image, error) Progress(ctx context.Context, album uint64) (float64, error) Checker }
Click to show internal directories.
Click to hide internal directories.