2019-04-15 05:22:00 +05:30
|
|
|
package queue
|
|
|
|
|
|
|
|
import "github.com/elyby/chrly/api/mojang"
|
|
|
|
|
2019-04-21 00:52:02 +05:30
|
|
|
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)
|
2019-04-15 05:22:00 +05:30
|
|
|
}
|
|
|
|
|
2019-04-21 00:52:02 +05:30
|
|
|
type Storage interface {
|
|
|
|
UuidsStorage
|
|
|
|
TexturesStorage
|
2019-04-15 05:22:00 +05:30
|
|
|
}
|
|
|
|
|
2019-04-21 00:52:02 +05:30
|
|
|
// This error can be used to indicate, that requested
|
|
|
|
// value doesn't exists in the storage
|
|
|
|
type ValueNotFound struct {
|
2019-04-15 05:22:00 +05:30
|
|
|
}
|
|
|
|
|
2019-04-21 00:52:02 +05:30
|
|
|
func (*ValueNotFound) Error() string {
|
|
|
|
return "value not found in storage"
|
2019-04-15 05:22:00 +05:30
|
|
|
}
|