mirror of
https://github.com/elyby/chrly.git
synced 2025-05-31 14:11:51 +05:30
#1: Split textures processing to 2 separate steps
This commit is contained in:
@@ -2,18 +2,29 @@ package queue
|
||||
|
||||
import "github.com/elyby/chrly/api/mojang"
|
||||
|
||||
type UuidsStorage interface {
|
||||
GetUuid(username string) (string, error)
|
||||
StoreUuid(username string, uuid string)
|
||||
}
|
||||
|
||||
type TexturesStorage interface {
|
||||
// nil can be returned to indicate that there is no textures for uuid
|
||||
// and we know about it. Return err only in case, when storage completely
|
||||
// don't know anything about uuid
|
||||
GetTextures(uuid string) (*mojang.SignedTexturesResponse, error)
|
||||
StoreTextures(textures *mojang.SignedTexturesResponse)
|
||||
}
|
||||
|
||||
type Storage interface {
|
||||
Get(username string) *mojang.SignedTexturesResponse
|
||||
Set(textures *mojang.SignedTexturesResponse)
|
||||
UuidsStorage
|
||||
TexturesStorage
|
||||
}
|
||||
|
||||
// NilStorage used for testing purposes
|
||||
type NilStorage struct {
|
||||
// This error can be used to indicate, that requested
|
||||
// value doesn't exists in the storage
|
||||
type ValueNotFound struct {
|
||||
}
|
||||
|
||||
func (*NilStorage) Get(username string) *mojang.SignedTexturesResponse {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*NilStorage) Set(textures *mojang.SignedTexturesResponse) {
|
||||
func (*ValueNotFound) Error() string {
|
||||
return "value not found in storage"
|
||||
}
|
||||
|
Reference in New Issue
Block a user