assets

package
v0.9.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2018 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSessionAssets

func NewSessionAssets(cache *AssetCache, server AssetServer) flows.SessionAssets

NewSessionAssets creates a new session assets instance with the provided base URLs

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) GetAsset

func (c *AssetCache) GetAsset(server AssetServer, itemType assetType, itemUUID string) (interface{}, error)

GetAsset gets an asset from the cache if it's there or from the asset server

func (*AssetCache) Include

func (c *AssetCache) Include(data json.RawMessage) error

Include loads assets from the given raw JSON into the cache

func (*AssetCache) Shutdown

func (c *AssetCache) Shutdown()

Shutdown shuts down this asset cache

type AssetServer

type AssetServer interface {
	// contains filtered or unexported methods
}

AssetServer describes the asset server we'll fetch missing assets from

func NewAssetServer

func NewAssetServer(authToken string, typeURLs map[assetType]string, httpClient *utils.HTTPClient) AssetServer

NewAssetServer creates a new asset server

func ReadAssetServer

func ReadAssetServer(authToken string, httpClient *utils.HTTPClient, 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() *MockAssetServer

NewMockAssetServer creates a new mocked asset server for testing

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL