Documentation
¶
Index ¶
- Variables
- type BatchUuidsProvider
- type BatchUuidsProviderStrategy
- type Emitter
- type FullBusStrategy
- type InMemoryTexturesStorage
- type JobsIteration
- type MojangApiTexturesProvider
- type NilProvider
- type PeriodicStrategy
- type Provider
- type RemoteApiUuidsProvider
- type SeparatedStorage
- func (s *SeparatedStorage) GetTextures(uuid string) (*mojang.SignedTexturesResponse, error)
- func (s *SeparatedStorage) GetUuid(username string) (string, bool, error)
- func (s *SeparatedStorage) StoreTextures(uuid string, textures *mojang.SignedTexturesResponse)
- func (s *SeparatedStorage) StoreUuid(username string, uuid string) error
- type Storage
- type TexturesProvider
- type TexturesStorage
- type UUIDsProvider
- type UUIDsStorage
- type UnexpectedRemoteApiResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var HttpClient = &http.Client{ Transport: &http.Transport{ MaxIdleConnsPerHost: 1024, }, }
Functions ¶
This section is empty.
Types ¶
type BatchUuidsProvider ¶
type BatchUuidsProvider struct {
// contains filtered or unexported fields
}
func NewBatchUuidsProvider ¶
func NewBatchUuidsProvider( context context.Context, strategy BatchUuidsProviderStrategy, emitter Emitter, ) *BatchUuidsProvider
func (*BatchUuidsProvider) GetUuid ¶
func (ctx *BatchUuidsProvider) GetUuid(username string) (*mojang.ProfileInfo, error)
type BatchUuidsProviderStrategy ¶
type BatchUuidsProviderStrategy interface { Queue(job *job) GetJobs(abort context.Context) <-chan *JobsIteration }
type Emitter ¶
type Emitter interface { dispatcher.Emitter }
type FullBusStrategy ¶
type FullBusStrategy struct { Delay time.Duration Batch int // contains filtered or unexported fields }
func NewFullBusStrategy ¶
func NewFullBusStrategy(delay time.Duration, batch int) *FullBusStrategy
func (*FullBusStrategy) GetJobs ¶
func (ctx *FullBusStrategy) GetJobs(abort context.Context) <-chan *JobsIteration
Формально, это описание логики водителя маршрутки xD
func (*FullBusStrategy) Queue ¶
func (ctx *FullBusStrategy) Queue(job *job)
type InMemoryTexturesStorage ¶
type InMemoryTexturesStorage struct { GCPeriod time.Duration Duration time.Duration // contains filtered or unexported fields }
func NewInMemoryTexturesStorage ¶
func NewInMemoryTexturesStorage() *InMemoryTexturesStorage
func (*InMemoryTexturesStorage) GetTextures ¶
func (s *InMemoryTexturesStorage) GetTextures(uuid string) (*mojang.SignedTexturesResponse, error)
func (*InMemoryTexturesStorage) Stop ¶
func (s *InMemoryTexturesStorage) Stop()
func (*InMemoryTexturesStorage) StoreTextures ¶
func (s *InMemoryTexturesStorage) StoreTextures(uuid string, textures *mojang.SignedTexturesResponse)
type JobsIteration ¶
type JobsIteration struct { Jobs []*job Queue int // contains filtered or unexported fields }
func (*JobsIteration) Done ¶
func (j *JobsIteration) Done()
type MojangApiTexturesProvider ¶
type MojangApiTexturesProvider struct {
Emitter
}
func (*MojangApiTexturesProvider) GetTextures ¶
func (ctx *MojangApiTexturesProvider) GetTextures(uuid string) (*mojang.SignedTexturesResponse, error)
type NilProvider ¶
type NilProvider struct { }
func (*NilProvider) GetForUsername ¶
func (p *NilProvider) GetForUsername(username string) (*mojang.SignedTexturesResponse, error)
type PeriodicStrategy ¶
type PeriodicStrategy struct { Delay time.Duration Batch int // contains filtered or unexported fields }
func NewPeriodicStrategy ¶
func NewPeriodicStrategy(delay time.Duration, batch int) *PeriodicStrategy
func (*PeriodicStrategy) GetJobs ¶
func (ctx *PeriodicStrategy) GetJobs(abort context.Context) <-chan *JobsIteration
func (*PeriodicStrategy) Queue ¶
func (ctx *PeriodicStrategy) Queue(job *job)
type Provider ¶
type Provider struct { Emitter UUIDsProvider TexturesProvider Storage // contains filtered or unexported fields }
func (Provider) AddListener ¶
Returns a boolean value, which will be true if the passed username didn't exist before
func (Provider) BroadcastAndRemove ¶
func (c Provider) BroadcastAndRemove(username string, result *broadcastResult)
func (*Provider) GetForUsername ¶
func (ctx *Provider) GetForUsername(username string) (*mojang.SignedTexturesResponse, error)
type RemoteApiUuidsProvider ¶
type RemoteApiUuidsProvider struct { Emitter Url URL }
func (*RemoteApiUuidsProvider) GetUuid ¶
func (ctx *RemoteApiUuidsProvider) GetUuid(username string) (*mojang.ProfileInfo, error)
type SeparatedStorage ¶
type SeparatedStorage struct { UUIDsStorage TexturesStorage }
SeparatedStorage allows you to use separate storage engines to satisfy the Storage interface
func (*SeparatedStorage) GetTextures ¶
func (s *SeparatedStorage) GetTextures(uuid string) (*mojang.SignedTexturesResponse, error)
func (*SeparatedStorage) GetUuid ¶
func (s *SeparatedStorage) GetUuid(username string) (string, bool, error)
func (*SeparatedStorage) StoreTextures ¶
func (s *SeparatedStorage) StoreTextures(uuid string, textures *mojang.SignedTexturesResponse)
type Storage ¶
type Storage interface { UUIDsStorage TexturesStorage }
type TexturesProvider ¶
type TexturesProvider interface {
GetTextures(uuid string) (*mojang.SignedTexturesResponse, error)
}
type TexturesStorage ¶
type TexturesStorage interface { // Error should not have nil value only if the repository failed to determine if there are any textures // for this uuid or not at all. If there is information about the absence of textures, nil nil should be returned GetTextures(uuid string) (*mojang.SignedTexturesResponse, error) // The nil value can be passed when there are no textures for the corresponding uuid and we know about it StoreTextures(uuid string, textures *mojang.SignedTexturesResponse) }
TexturesStorage is a Mojang's textures storage, used as a values cache to avoid 429 errors
type UUIDsProvider ¶
type UUIDsProvider interface {
GetUuid(username string) (*mojang.ProfileInfo, error)
}
type UUIDsStorage ¶
type UUIDsStorage interface { // The second argument indicates whether a record was found in the storage, // since depending on it, the empty value must be interpreted as "no cached record" // or "value cached and has an empty value" GetUuid(username string) (uuid string, found bool, err error) // An empty uuid value can be passed if the corresponding account has not been found StoreUuid(username string, uuid string) error }
UUIDsStorage is a key-value storage of Mojang usernames pairs to its UUIDs, used to reduce the load on the account information queue
type UnexpectedRemoteApiResponse ¶
func (*UnexpectedRemoteApiResponse) Error ¶
func (*UnexpectedRemoteApiResponse) Error() string
Click to show internal directories.
Click to hide internal directories.