Experiment holds data associated with an experimental feature for frontend
or worker.
Description provides a description of the experiment.
Name is the name of the feature.
Rollout is the percentage of requests enrolled in the experiment.
func golang.org/x/pkgsite/internal/middleware.(*Experimenter).Experiments() []*Experiment
func golang.org/x/pkgsite/internal/proxydatasource.(*DataSource).GetExperiments(ctx context.Context) ([]*Experiment, error)
func golang.org/x/pkgsite/internal/middleware.shouldSetExperiment(r *http.Request, e *Experiment) bool
LatestInfo holds information about the latest versions and paths.
The information is relative to a unit in a module.
MajorModulePath is the path of the latest module path in the series.
For example, in the module path "github.com/casbin/casbin", there
is another module path with a greater major version
"github.com/casbin/casbin/v3". This field will be
"github.com/casbin/casbin/v3" or the input module path if no later module
path was found.
MajorUnitPath is the path of the unit in the latest major version of the
module, if it exists. For example, if the module is M, the unit is M/U,
and the latest major version is 3, then is field is "M/v3/U". If the module version
at MajorModulePath does not contain this unit, then it is the module path."
MinorModulePath is the module path for MinorVersion.
MinorVersion is the latest minor version for the unit, regardless of
module.
UnitExistsAtMinor is whether the unit exists at the latest minor version
of the module
func DataSource.GetLatestInfo(ctx context.Context, unitPath, modulePath string, latestUnitMeta *UnitMeta) (LatestInfo, error)
func golang.org/x/pkgsite/internal/frontend.(*Server).GetLatestInfo(ctx context.Context, unitPath, modulePath string, latestUnitMeta *UnitMeta) LatestInfo
func golang.org/x/pkgsite/internal/localdatasource.(*DataSource).GetLatestInfo(ctx context.Context, unitPath, modulePath string, latestUnitMeta *UnitMeta) (LatestInfo, error)
func golang.org/x/pkgsite/internal/postgres.(*DB).GetLatestInfo(ctx context.Context, unitPath, modulePath string, latestUnitMeta *UnitMeta) (latest LatestInfo, err error)
func golang.org/x/pkgsite/internal/proxydatasource.(*DataSource).GetLatestInfo(ctx context.Context, unitPath, modulePath string, latestUnitMeta *UnitMeta) (latest LatestInfo, err error)
func golang.org/x/pkgsite/internal/frontend.latestMinorClass(version string, latest LatestInfo) string
ModuleVersionState holds a worker module version state.
AppVersion is the value of the GAE_VERSION environment variable, which is
set by app engine. It is a timestamp in the format 20190709t112655 that
is close to, but not the same as, the deployment time. For example, the
deployment time for the above timestamp might be Jul 9, 2019, 11:29:59 AM.
CreatedAt is the time this version was originally inserted into the
module version state table.
Error is the most recent HTTP response body received from the Fetch
service, for a response with an unsuccessful status code. It is used for
debugging only, and has no semantic significance.
GoModPath is the path declared in the go.mod file fetched from the proxy.
HasGoMod says whether the zip file has a go.mod file.
IndexTimestamp is the timestamp received from the Index for this version,
which should correspond to the time this version was committed to the
Index.
LastProcessedAt is the last time this version was updated with a result
from the fetch service.
ModulePathstring
NextProcessedAfter is the next time a fetch for this version should be
attempted.
NumPackages it the number of packages that were processed as part of the
module (regardless of whether the processing was successful).
Status is the most recent HTTP status code received from the Fetch service
for this version, or nil if no request to the fetch service has been made.
TryCount is the number of times a fetch of this version has been
attempted.
Versionstring
func golang.org/x/pkgsite/internal/postgres.(*DB).GetModuleVersionState(ctx context.Context, modulePath, resolvedVersion string) (_ *ModuleVersionState, err error)
func golang.org/x/pkgsite/internal/postgres.(*DB).GetNextModulesToFetch(ctx context.Context, limit int) (_ []*ModuleVersionState, err error)
func golang.org/x/pkgsite/internal/postgres.(*DB).GetRecentFailedVersions(ctx context.Context, limit int) (_ []*ModuleVersionState, err error)
func golang.org/x/pkgsite/internal/postgres.(*DB).GetRecentVersions(ctx context.Context, limit int) (_ []*ModuleVersionState, err error)
func golang.org/x/pkgsite/internal/postgres.scanModuleVersionState(scan func(dest ...interface{}) error) (*ModuleVersionState, error)
func golang.org/x/pkgsite/internal/postgres.(*DB).queryModuleVersionStates(ctx context.Context, queryFormat string, args ...interface{}) ([]*ModuleVersionState, error)
func golang.org/x/pkgsite/internal/worker.shouldDisableProxyFetch(m *ModuleVersionState) bool
SearchResult represents a single search result from SearchDocuments.
Approximate reports whether NumResults is an approximate count. NumResults
can be approximate if search scanned only a subset of documents, and
result count is estimated using the hyperloglog algorithm.
CommitTimetime.TimeLicenses[]string
LowerMajor is a list of SearchResults with the same v1 path but at lower
major versions of this module.
ModulePathstringNamestring
NumImportedBy is the number of packages that import PackagePath.
NumResults is the total number of packages that were returned for this
search.
PackagePathstring
SameModule is a list of SearchResults from the same module as this one,
with lower scores.
Score is used to sort items in an array of SearchResult.
Symbols are the symbols returned by a search request.
SynopsisstringVersionstring
func golang.org/x/pkgsite/internal/postgres.(*DB).Search(ctx context.Context, q string, limit, offset, maxResultCount int, searchSymbols bool) (_ []*SearchResult, err error)
func golang.org/x/pkgsite/internal/postgres.groupSearchResults(rs []*SearchResult) []*SearchResult
func golang.org/x/pkgsite/internal/frontend.modulePaths(heading string, rs []*SearchResult) *frontend.subResult
func golang.org/x/pkgsite/internal/frontend.packagePaths(heading string, rs []*SearchResult, max int) *frontend.subResult
func golang.org/x/pkgsite/internal/postgres.groupSearchResults(rs []*SearchResult) []*SearchResult
func golang.org/x/pkgsite/internal/postgres.(*DB).addPackageDataToSearchResults(ctx context.Context, results []*SearchResult) (err error)
Symbol is an element in the package API. A symbol can be a constant,
variable, function, or type.
Children contain the child symbols for this symbol. This will
only be populated when the SymbolType is "Type". For example, the
children of net/http.Handler are FileServer, NotFoundHandler,
RedirectHandler, StripPrefix, and TimeoutHandler. Each child
symbol will have ParentName set to the Name of this type.
GOARCH specifies the execution architecture where the symbol appears.
GOOS specifies the execution operating system where the symbol appears.
SymbolMetaSymbolMeta
Kind is the type of a symbol, which is either a constant, variable,
function, type, field or method.
Name is the name of the symbol.
ParentName if name of the parent type if available, otherwise
the empty string. For example, the parent type for
net/http.FileServer is Handler.
Section is the section that a symbol appears in.
Synopsis is the one line description of the symbol as displayed
in the package documentation.
func golang.org/x/pkgsite/internal/godoc.(*Package).DocInfo(ctx context.Context, innerPath string, sourceInfo *source.Info, modInfo *godoc.ModuleInfo) (synopsis string, imports []string, api []*Symbol, err error)
func golang.org/x/pkgsite/internal/godoc/dochtml.GetSymbols(p *doc.Package, fset *token.FileSet) (_ []*Symbol, err error)
func golang.org/x/pkgsite/internal/fetch.loadPackageForBuildContext(ctx context.Context, files map[string][]byte, innerPath string, sourceInfo *source.Info, modInfo *godoc.ModuleInfo) (name string, imports []string, synopsis string, source []byte, api []*Symbol, err error)
func golang.org/x/pkgsite/internal/godoc/dochtml.constants(consts []*doc.Value) []*Symbol
func golang.org/x/pkgsite/internal/godoc/dochtml.functions(p *doc.Package, fset *token.FileSet) []*Symbol
func golang.org/x/pkgsite/internal/godoc/dochtml.types(p *doc.Package, fset *token.FileSet) ([]*Symbol, error)
func golang.org/x/pkgsite/internal/godoc/dochtml.variables(vars []*doc.Value, fset *token.FileSet) (_ []*Symbol, err error)
func golang.org/x/pkgsite/internal/postgres.getUnitSymbols(ctx context.Context, db *database.DB, unitID int) (_ map[BuildContext][]*Symbol, err error)
func golang.org/x/pkgsite/internal/postgres.updateSymbols(symbols []*Symbol, updateFunc func(sm *SymbolMeta) error) error
var golang.org/x/pkgsite/internal/testing/sample.Constant *Symbol
var golang.org/x/pkgsite/internal/testing/sample.Function *Symbol
var golang.org/x/pkgsite/internal/testing/sample.FunctionNew *Symbol
var golang.org/x/pkgsite/internal/testing/sample.Type *Symbol
var golang.org/x/pkgsite/internal/testing/sample.Variable *Symbol
SymbolBuildContexts represents the build contexts that are associated with a
SymbolMeta.
builds are the build contexts that apply to this symbol.
AddBuildContext adds a build context supported by this UnitSymbol.
BuildContexts returns the build contexts for this UnitSymbol.
InAll reports whether the unit symbol supports all build contexts.
RemoveBuildContexts removes all of the build contexts associated with this
unit symbol.
SupportsBuild reports whether the provided build is supported by this
UnitSymbol. If the build is BuildContextAll, this is interpreted as this
unit symbol supports at least one build context.
func (*SymbolHistory).SymbolsAtVersion(v string) map[string]map[SymbolMeta]*SymbolBuildContexts
func golang.org/x/pkgsite/internal/frontend.findParent(parentName string, cus *SymbolBuildContexts, nameToMetaToSymbol map[string]map[SymbolMeta]*frontend.Symbol) *frontend.Symbol
func golang.org/x/pkgsite/internal/frontend.symbolsForVersion(pkgURLPath string, symbolsAtVersion map[string]map[SymbolMeta]*SymbolBuildContexts) [][]*frontend.Symbol
SymbolHistory represents the history for when a symbol name was first added
to a package.
m is a map of version to name to SymbolMeta to UnitSymbol.
SymbolMeta is stored as a distinct key from name, since it is possible
for a symbol in the same version for different build contexts to have
different SymbolMeta. For example:
https://pkg.go.dev/syscall@go1.16.3#CloseOnExec has function signature:
func CloseOnExec(fd int)
versus
https://pkg.go.dev/syscall?GOOS=windows#CloseOnExec has function
signature:
func CloseOnExec(fd Handle)
AddSymbol adds the given symbol to SymbolHistory.
GetSymbol returns the unit symbol for a given name, version and build context.
SymbolsAtVersion returns a map of name to SymbolMeta to UnitSymbol for a
given version.
Versions returns an array of the versions in versionToNameToUnitSymbol, sorted by
increasing semver.
func NewSymbolHistory() *SymbolHistory
func golang.org/x/pkgsite/internal/frontend.ParseVersionsDetails(vd frontend.VersionsDetails) (_ *SymbolHistory, err error)
func golang.org/x/pkgsite/internal/postgres.GetSymbolHistoryFromTable(ctx context.Context, ddb *database.DB, packagePath, modulePath string) (_ *SymbolHistory, err error)
func golang.org/x/pkgsite/internal/postgres.GetSymbolHistoryWithPackageSymbols(ctx context.Context, ddb *database.DB, packagePath, modulePath string) (_ *SymbolHistory, err error)
func golang.org/x/pkgsite/internal/postgres.(*DB).GetSymbolHistory(ctx context.Context, packagePath, modulePath string) (_ *SymbolHistory, err error)
func golang.org/x/pkgsite/internal/symbol.IntroducedHistory(sh *SymbolHistory) (outSH *SymbolHistory, err error)
func golang.org/x/pkgsite/internal/postgres.collectSymbolHistory(check func(sh *SymbolHistory, sm SymbolMeta, v string, build BuildContext) error) (*SymbolHistory, func(rows *sql.Rows) error)
func golang.org/x/pkgsite/internal/postgres.getPackageSymbols(ctx context.Context, ddb *database.DB, packagePath, modulePath string) (_ *SymbolHistory, err error)
func golang.org/x/pkgsite/internal/symbol.CompareAPIVersions(path string, apiVersions symbol.pkgAPIVersions, inSH *SymbolHistory) ([]string, error)
func golang.org/x/pkgsite/internal/symbol.IntroducedHistory(sh *SymbolHistory) (outSH *SymbolHistory, err error)
func golang.org/x/pkgsite/internal/frontend.addSymbol(s *frontend.Symbol, v string, sh *SymbolHistory, builds []string)
func golang.org/x/pkgsite/internal/frontend.buildVersionDetails(currentModulePath string, modInfos []*ModuleInfo, sh *SymbolHistory, linkify func(v *ModuleInfo) string) *frontend.VersionsDetails
Package-Level Functions (total 12, in which 10 are exported)
CandidateModulePaths returns the potential module paths that could contain
the fullPath, from longest to shortest. It returns nil if no valid module
paths can be constructed.
CompareBuildContexts returns a negative number, 0, or a positive number depending on
the relative positions of c1 and c2 in BuildContexts.
DocumentationForBuildContext returns the first Documentation the list that
matches the BuildContext, or nil if none does. A Documentation matches if its
GOOS and GOARCH fields are the same as those of the BuildContext, or if the
Documentation field is "all", or if the BuildContext field is empty. That is,
empty BuildContext fields act as wildcards. So the zero BuildContext will
match the first element of docs, if there is one.
MajorVersionForModule returns the final "vN" from the module path, if any.
It returns the empty string if the module path is malformed.
Examples:
"m.com" => ""
"m.com/v2" => "v2"
"gpkg.in/m.v1 = "v1"
SeriesPathAndMajorVersion splits modulePath into a series path and a
numeric major version.
If the path doesn't have a "vN" suffix, it returns 1.
If the module path is invalid, it returns ("", 0).
SeriesPathForModule returns the series path for the provided modulePath.
Suffix returns the suffix of the fullPath. It assumes that basePath is a
prefix of fullPath. If fullPath and basePath are the same, the empty string
is returned.
V1Path returns the path for version 1 of the package whose import path
is fullPath. If modulePath is the standard library, then V1Path returns
fullPath.
isDeprecated reports whether the go.mod deprecates this module.
It looks for "Deprecated" comments in the line comments before and next to
the module declaration. If it finds one, it returns true along with the text
after "Deprecated:". Otherwise it returns false, "".
isRetracted reports whether the go.mod file retracts the version.
If so, it returns true along with the rationale for the retraction.
Package-Level Variables (total 9, in which 8 are exported)
BuildContexts are the build contexts we check when loading a package (see
internal/fetch/load.go).
We store documentation for all of the listed contexts.
The order determines which environment's docs we will show as the default.
LatestVersion signifies the latest available version in requests to the
proxy client.
MainVersion represents the main branch.
MasterVersion represents the master branch.
MinimalFields is the empty FieldSet.
StringFieldMissing is the value for string fields that are not present
in a struct. We use it to distinguish a (possibly valid) empty string
from a field that was never populated.
UnknownModulePath signifies that the module path for a given package
path is ambiguous or not known. This is because requests to the
frontend can come in the form of <import-path>[@<version>], and it is
not clear which part of the import-path is the module path.
FieldSet bits for fields that can be conditionally read from the data store.
FieldSet bits for fields that can be conditionally read from the data store.
FieldSet bits for fields that can be conditionally read from the data store.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.