resourcehandlers

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry interface {
	Load(rhs ...ResourceHandler)
	Get(uri string) ResourceHandler
	Remove(rh ...ResourceHandler)
}

Registry can register and return resource handlers for a url

func NewRegistry

func NewRegistry(resourceHandlers ...ResourceHandler) Registry

NewRegistry creates Registry object, optionally loading it with resurceHanbdlers if provided

type ResourceHandler

type ResourceHandler interface {
	// Accepts manifests if this ResourceHandler can manage the type of resources
	// identified by the URI scheme of uri.
	Accept(uri string) bool
	// ResolveNodeSelector resolves the NodeSelector rules of a Node into subnodes
	// hierarchy (Node.Nodes)
	ResolveNodeSelector(ctx context.Context, node *api.Node) error
	// Read a resource content at uri into a byte array
	Read(ctx context.Context, uri string) ([]byte, error)
	// Name resolves the name of the resource from a URI
	// Example: https://github.com/owner/repo/tree/master/a/b/c.md -> c.md
	Name(uri string) string
	// ResolveRelLink should return an absolute path of a relative link in regards of the provided
	// source
	BuildAbsLink(source, link string) (string, error)
	// GetLocalityDomainCandidate ...
	GetLocalityDomainCandidate(source string) (key, path, version string, err error)
	// SetVersion
	SetVersion(absLink, version string) (string, error)
}

ResourceHandler does resource specific operations on a type of objects identified by an uri schem that it accepts to handle

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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