cache

package
v0.0.0-...-3999d51 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: BSD-3-Clause Imports: 43 Imported by: 0

Documentation

Overview

Package cache implements the caching layer for gopls.

Index

Constants

View Source
const (
	ModTidyError = "go mod tidy"
	SyntaxError  = "syntax"
)

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

This section is empty.

Types

type Cache

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

func New

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

func (*Cache) FileSet

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

func (*Cache) GetFile

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

func (*Cache) ID

func (c *Cache) ID() string

func (*Cache) MemStats

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

func (*Cache) NewSession

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

func (*Cache) PackageStats

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

func (*Cache) ParseGoHandle

func (c *Cache) ParseGoHandle(ctx context.Context, fh source.FileHandle, mode source.ParseMode) source.ParseGoHandle

type Session

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

func (*Session) Cache

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

func (*Session) DidModifyFiles

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

func (*Session) GetFile

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

func (*Session) ID

func (s *Session) ID() string

func (*Session) NewView

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

func (*Session) Options

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

func (*Session) Overlays

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

func (*Session) SetOptions

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

func (*Session) Shutdown

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

func (*Session) String

func (s *Session) String() string

func (*Session) View

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

View returns the view by name.

func (*Session) ViewOf

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

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

type SessionKey

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

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

func NewSessionKey

func NewSessionKey(name, description string) *SessionKey

NewSessionKey creates a new Key for *Session values.

func (*SessionKey) Description

func (k *SessionKey) Description() string

func (*SessionKey) Format

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

func (*SessionKey) From

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

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

func (*SessionKey) Get

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

func (k *SessionKey) Name() string

func (*SessionKey) Of

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

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

type View

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

func (*View) BackgroundContext

func (v *View) BackgroundContext() context.Context

func (*View) BuiltinPackage

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

func (*View) Folder

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

Folder returns the root of this view.

func (*View) ID

func (v *View) ID() string

func (*View) IsGoPrivatePath

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

func (*View) ModFiles

func (v *View) ModFiles() (span.URI, span.URI)

func (*View) Name

func (v *View) Name() string

Name returns the user visible name of this view.

func (*View) Options

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

func (*View) Rebuild

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

func (*View) RunProcessEnvFunc

func (v *View) RunProcessEnvFunc(ctx context.Context, fn func(*imports.Options) error) error

func (*View) Session

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

func (*View) SetOptions

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

func (*View) Shutdown

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

func (*View) Snapshot

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

func (*View) ValidBuildConfiguration

func (v *View) ValidBuildConfiguration() bool

func (*View) WriteEnv

func (v *View) WriteEnv(ctx context.Context, w io.Writer) error

Jump to

Keyboard shortcuts

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