Documentation ¶
Index ¶
- func RegisterType(name AssetType, manageAsSet bool, reader AssetReader)
- type AssetCache
- type AssetReader
- type AssetServer
- type AssetType
- type MockAssetServer
- func (s *MockAssetServer) GetAsset(itemType AssetType, itemUUID string) (interface{}, error)
- func (s *MockAssetServer) IsTypeSupported(itemType AssetType) bool
- func (s *MockAssetServer) MarshalJSON() ([]byte, error)
- func (s *MockAssetServer) MockResponse(url string, response json.RawMessage)
- func (s *MockAssetServer) MockedRequests() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterType ¶
func RegisterType(name AssetType, manageAsSet bool, reader AssetReader)
RegisterType registers a new asset type for use with this cache
Types ¶
type AssetCache ¶
type AssetCache struct {
// contains filtered or unexported fields
}
AssetCache fetches and caches assets for the engine
func NewAssetCache ¶
func NewAssetCache(maxSize int64, pruneItems int) *AssetCache
NewAssetCache creates a new asset cache
func (*AssetCache) Include ¶
func (c *AssetCache) Include(data json.RawMessage) error
Include loads assets from the given raw JSON into the cache
type AssetReader ¶
type AssetReader func(data json.RawMessage) (interface{}, error)
AssetReader is a function capable of reading an asset type from JSON
type AssetServer ¶
type AssetServer interface { IsTypeSupported(AssetType) bool GetAsset(AssetType, string) (interface{}, error) }
AssetServer describes the asset server we'll fetch missing assets from
func NewAssetServer ¶
func NewAssetServer(authToken string, typeURLs map[AssetType]string, httpClient *utils.HTTPClient, cache *AssetCache) AssetServer
NewAssetServer creates a new asset server
func ReadAssetServer ¶
func ReadAssetServer(authToken string, httpClient *utils.HTTPClient, cache *AssetCache, data json.RawMessage) (AssetServer, error)
ReadAssetServer reads an asset server fronm the given JSON
type MockAssetServer ¶
type MockAssetServer struct {
// contains filtered or unexported fields
}
func NewMockAssetServer ¶
func NewMockAssetServer(typeURLs map[AssetType]string, cache *AssetCache) *MockAssetServer
NewMockAssetServer creates a new mocked asset server for testing
func (*MockAssetServer) GetAsset ¶
func (s *MockAssetServer) GetAsset(itemType AssetType, itemUUID string) (interface{}, error)
GetAsset returns either a single item or the set of items
func (*MockAssetServer) IsTypeSupported ¶
IsTypeSupported returns whether the given asset item type is supported
func (*MockAssetServer) MarshalJSON ¶
func (s *MockAssetServer) MarshalJSON() ([]byte, error)
MarshalJSON marshals this mock asset server into JSON
func (*MockAssetServer) MockResponse ¶
func (s *MockAssetServer) MockResponse(url string, response json.RawMessage)
func (*MockAssetServer) MockedRequests ¶
func (s *MockAssetServer) MockedRequests() []string