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 resourceHandlers 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, excludePaths []string, frontMatter map[string]interface{}, excludeFrontMatter map[string]interface{}, depth int32) error
// Read a resource content at uri into a byte array
Read(ctx context.Context, uri string) ([]byte, error)
// ResourceName returns a breakdown of a resource name in the link, consisting
// of name and potentially and extention without the dot.
ResourceName(link string) (string, string)
// BuildAbsLink should return an absolute path of a relative link in regards of the provided
// source
BuildAbsLink(source, link string) (string, error)
// GetRawFormatLink returns a link to an embedable object (image) in raw format.
// If the provided link is not referencing an embedable object, the function
// returns absLink without changes.
GetRawFormatLink(absLink string) (string, error)
// SetVersion sets version to absLink according to the API scheme. For GitHub
// for example this would replace e.g. the 'master' segment in the path with version
SetVersion(absLink, version string) (string, error)
}
ResourceHandler does resource specific operations on a type of objects identified by an uri schema that it accepts to handle
Click to show internal directories.
Click to hide internal directories.