resource

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles resource operations and maintains resource state.

func NewManager

func NewManager() *Manager

NewManager creates a new resource manager instance.

func (*Manager) AddRoot

func (m *Manager) AddRoot(root models.Root) error

AddRoot adds a new root path to the manager.

func (*Manager) GetCompletions

func (m *Manager) GetCompletions(uri string, argName, prefix string) ([]string, bool, *int, error)

GetCompletions returns completion options for a resource argument. It analyzes the resource contents and returns possible completions that match the provided prefix.

func (*Manager) ListResources

func (m *Manager) ListResources(ctx context.Context, cursor *models.Cursor) ([]models.Resource, *models.Cursor, error)

ListResources returns a list of available resources.

func (*Manager) ReadResource

func (m *Manager) ReadResource(ctx context.Context, uri string) ([]models.ResourceContent, error)

ReadResource reads the contents of a specific resource.

func (*Manager) Shutdown

func (m *Manager) Shutdown(ctx context.Context) error

Shutdown performs orderly cleanup of all resources.

func (*Manager) Subscribe

func (m *Manager) Subscribe(uri string) (*Subscription, error)

Subscribe adds a subscriber for resource updates.

func (*Manager) UpdateResource

func (m *Manager) UpdateResource(uri string, content string) error

UpdateResource updates the content of a resource and notifies subscribers.

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

Subscription represents an active subscription to resource updates.

func (*Subscription) Channel

func (s *Subscription) Channel() <-chan *models.ResourceUpdatedNotification

Channel returns the notification channel for this subscription.

func (*Subscription) Close

func (s *Subscription) Close()

Close closes the subscription and removes it from the manager.

Jump to

Keyboard shortcuts

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