cache

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: BSD-3-Clause, BSD-3-Clause Imports: 51 Imported by: 0

Documentation

Overview

Package cache implements the caching layer for gopls.

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyCreateSession   = NewSessionKey("create_session", "A new session was added")
	KeyUpdateSession   = NewSessionKey("update_session", "Updated information about a session")
	KeyShutdownSession = NewSessionKey("shutdown_session", "A session was shut down")
)

Functions

func BuildGoplsMod added in v0.0.33

func BuildGoplsMod(ctx context.Context, root span.URI, s source.Snapshot) (*modfile.File, error)

BuildGoplsMod generates a go.mod file for all modules in the workspace. It bypasses any existing gopls.mod.

Types

type Cache added in v0.0.30

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

func New

func New(ctx context.Context, options func(*source.Options)) *Cache

func (*Cache) FileSet added in v0.0.30

func (c *Cache) FileSet() *token.FileSet

func (*Cache) GetFile added in v0.0.30

func (c *Cache) GetFile(ctx context.Context, uri span.URI) (source.FileHandle, error)

func (*Cache) ID added in v0.0.30

func (c *Cache) ID() string

func (*Cache) MemStats added in v0.0.32

func (c *Cache) MemStats() map[reflect.Type]int

func (*Cache) NewSession added in v0.0.30

func (c *Cache) NewSession(ctx context.Context) *Session

func (*Cache) PackageStats added in v0.0.32

func (c *Cache) PackageStats(withNames bool) template.HTML

type Session added in v0.0.30

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

func (*Session) Cache added in v0.0.30

func (s *Session) Cache() interface{}

func (*Session) DidModifyFiles added in v0.0.30

func (s *Session) DidModifyFiles(ctx context.Context, changes []source.FileModification) (map[source.Snapshot][]span.URI, []func(), error)

func (*Session) ExpandModificationsToDirectories added in v0.0.33

func (s *Session) ExpandModificationsToDirectories(ctx context.Context, changes []source.FileModification) []source.FileModification

func (*Session) FileWatchingGlobPatterns added in v0.0.33

func (s *Session) FileWatchingGlobPatterns(ctx context.Context) map[string]struct{}

func (*Session) GetFile added in v0.0.30

func (s *Session) GetFile(ctx context.Context, uri span.URI) (source.FileHandle, error)

func (*Session) ID added in v0.0.32

func (s *Session) ID() string

func (*Session) ModifyFiles added in v0.0.32

func (s *Session) ModifyFiles(ctx context.Context, changes []source.FileModification) error

func (*Session) NewView added in v0.0.30

func (s *Session) NewView(ctx context.Context, name string, folder, tempWorkspace span.URI, options *source.Options) (source.View, source.Snapshot, func(), error)

func (*Session) Options added in v0.0.30

func (s *Session) Options() *source.Options

func (*Session) Overlays added in v0.0.32

func (s *Session) Overlays() []source.Overlay

func (*Session) SetOptions added in v0.0.30

func (s *Session) SetOptions(options *source.Options)

func (*Session) Shutdown added in v0.0.30

func (s *Session) Shutdown(ctx context.Context)

func (*Session) String added in v0.0.32

func (s *Session) String() string

func (*Session) View added in v0.0.30

func (s *Session) View(name string) source.View

View returns the view by name.

func (*Session) ViewOf added in v0.0.30

func (s *Session) ViewOf(uri span.URI) (source.View, error)

ViewOf returns a view corresponding to the given URI. If the file is not already associated with a view, pick one using some heuristics.

func (*Session) Views added in v0.0.30

func (s *Session) Views() []source.View

type SessionKey added in v0.0.32

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

SessionKey represents an event label key that has a *Session value.

func NewSessionKey added in v0.0.32

func NewSessionKey(name, description string) *SessionKey

NewSessionKey creates a new Key for *Session values.

func (*SessionKey) Description added in v0.0.32

func (k *SessionKey) Description() string

func (*SessionKey) Format added in v0.0.32

func (k *SessionKey) Format(w io.Writer, buf []byte, l label.Label)

func (*SessionKey) From added in v0.0.32

func (k *SessionKey) From(t label.Label) *Session

From can be used to get the session value from a Label.

func (*SessionKey) Get added in v0.0.32

func (k *SessionKey) Get(lm label.Map) *Session

Get can be used to get the session for the key from a label.Map.

func (*SessionKey) Name added in v0.0.32

func (k *SessionKey) Name() string

func (*SessionKey) Of added in v0.0.32

func (k *SessionKey) Of(v *Session) label.Label

Of creates a new Label with this key and the supplied session.

type View added in v0.0.32

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

func (*View) Folder added in v0.0.32

func (v *View) Folder() span.URI

Folder returns the folder at the base of this view.

func (*View) ID added in v0.0.32

func (v *View) ID() string

func (*View) IsGoPrivatePath added in v0.0.32

func (v *View) IsGoPrivatePath(target string) bool

func (*View) ModuleUpgrades added in v0.0.33

func (v *View) ModuleUpgrades() map[string]string

func (*View) Name added in v0.0.32

func (v *View) Name() string

Name returns the user visible name of this view.

func (*View) Options added in v0.0.32

func (v *View) Options() *source.Options

func (*View) Rebuild added in v0.0.32

func (v *View) Rebuild(ctx context.Context) (source.Snapshot, func(), error)

func (*View) RegisterModuleUpgrades added in v0.0.33

func (v *View) RegisterModuleUpgrades(upgrades map[string]string)

func (*View) Session added in v0.0.33

func (v *View) Session() *Session

func (*View) SetOptions added in v0.0.32

func (v *View) SetOptions(ctx context.Context, options *source.Options) (source.View, error)

func (*View) Shutdown added in v0.0.32

func (v *View) Shutdown(ctx context.Context)

func (*View) Snapshot added in v0.0.32

func (v *View) Snapshot(ctx context.Context) (source.Snapshot, func())

Jump to

Keyboard shortcuts

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