Documentation
¶
Index ¶
- Constants
- func AddFilesystem(name string, filesystem fs.FS)
- func GetFilesystem(name string) fs.FS
- func GetSupportedResourceTypes() []string
- func KeyFromPath(p string) string
- func Load(ctx finch.Context, handles ...ResourceHandle)
- func LoadData(ctx finch.Context, key string, metadata *Metadata) ([]byte, error)
- func LoadManifest(ctx finch.Context, p string)
- func RegisterSystem(system ResourceSystem)
- type Manifest
- type Metadata
- type ResourceHandle
- type ResourceSystem
- type ResourceSystemType
Constants ¶
const ( MetadataRoot = "root" MetadataPath = "path" MetadataType = "type" )
const BatchSize = 100
const JsonName = "resource.manifest"
Variables ¶
This section is empty.
Functions ¶
func AddFilesystem ¶
func GetFilesystem ¶
func GetSupportedResourceTypes ¶
func GetSupportedResourceTypes() []string
func KeyFromPath ¶
func Load ¶
func Load(ctx finch.Context, handles ...ResourceHandle)
func LoadManifest ¶
func RegisterSystem ¶
func RegisterSystem(system ResourceSystem)
Types ¶
type Manifest ¶
func GetManifest ¶
func GetManifest() Manifest
type ResourceHandle ¶
type ResourceHandle string
ResourceHandle provides an accessor for information about a specific resource, including its key, metadata, and loaded state.
ResourceHandles are used throughout the resource management framework to reference and manage individual resources. They encapsulate the resource key and provide methods to access associated metadata and check if the resource is currently loaded.
func (ResourceHandle) IsLoaded ¶
func (r ResourceHandle) IsLoaded() bool
func (ResourceHandle) Key ¶
func (r ResourceHandle) Key() string
func (ResourceHandle) Metadata ¶
func (r ResourceHandle) Metadata() (*Metadata, bool)
type ResourceSystem ¶
type ResourceSystem interface {
ResourceTypes() []string
Type() ResourceSystemType
Load(ctx finch.Context, handle ResourceHandle) error
Unload(ctx finch.Context, handle ResourceHandle) error
GetDependencies(ctx finch.Context, handle ResourceHandle) []ResourceHandle
GenerateMetadata(ctx finch.Context, key string, metadata *Metadata) error
IsLoaded(handle ResourceHandle) bool
}
ResourceSystem defines a system that can load and manage resources of specific types.
Each ResourceSystem must implement this interface to be registered and used within the resource management framework. ResourceSystems are responsible for loading, unloading, and providing metadata properties for resources of the types they support. The resource management framework loads large numbers of resources in batches, so ResourceSystems should be designed to handle concurrent load requests efficiently.
func GetSystem ¶
func GetSystem(st ResourceSystemType) ResourceSystem
func SystemForType ¶
func SystemForType(rt string) ResourceSystem
type ResourceSystemType ¶
type ResourceSystemType uint64
func NewResourceSystemKey ¶
func NewResourceSystemKey[T ResourceSystem]() ResourceSystemType