Documentation
¶
Index ¶
- type Handler
- type Registry
- func (r *Registry) ListResourceTemplates(_ context.Context) ([]protocol.ResourceTemplate, error)
- func (r *Registry) ListResources(_ context.Context, cursor string) ([]protocol.Resource, string, error)
- func (r *Registry) ReadResource(_ context.Context, uri string) ([]protocol.ResourceContent, error)
- func (r *Registry) RegisterResource(resource protocol.Resource)
- func (r *Registry) RegisterResourceWithHandler(resource protocol.Resource, handler Handler)
- func (r *Registry) SubscribeToResource(_ context.Context, uri string) (chan struct{}, func(), error)
- func (r *Registry) UnregisterResource(uri string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler func(resource protocol.Resource) (*protocol.ResourceContent, error)
Handler is a function that provides the content for a resource
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry provides a simple way to register individual resources
func (*Registry) ListResourceTemplates ¶
ListResourceTemplates implements ResourceProvider interface
func (*Registry) ListResources ¶
func (r *Registry) ListResources(_ context.Context, cursor string) ([]protocol.Resource, string, error)
ListResources implements ResourceProvider interface
func (*Registry) ReadResource ¶
ReadResource implements ResourceProvider interface
func (*Registry) RegisterResource ¶
RegisterResource adds a resource to the registry
func (*Registry) RegisterResourceWithHandler ¶
RegisterResourceWithHandler adds a resource with a custom handler
func (*Registry) SubscribeToResource ¶
func (r *Registry) SubscribeToResource(_ context.Context, uri string) (chan struct{}, func(), error)
SubscribeToResource implements ResourceProvider interface
func (*Registry) UnregisterResource ¶
UnregisterResource removes a resource from the registry
Click to show internal directories.
Click to hide internal directories.