pkgsite: golang.org/x/pkgsite/internal/worker Index | Files

package worker

import "golang.org/x/pkgsite/internal/worker"

Package worker provides functionality for running a worker service. Its primary operation is to fetch modules from a proxy and write them to the database.

Index

Package Files

fetch.go memory.go metrics.go pages.go server.go

Variables

var (

    // EnqueueResponseCount counts worker enqueue responses by response type.
    EnqueueResponseCount = &view.View{
        Name:        "go-discovery/worker-enqueue/count",
        Measure:     enqueueStatus,
        Aggregation: view.Count(),
        Description: "Worker enqueue request count",
        TagKeys:     []tag.Key{keyEnqueueStatus},
    }

    ProcessingLag = &view.View{
        Name:        "go-discovery/worker_processing_lag",
        Measure:     processingLag,
        Aggregation: view.LastValue(),
        Description: "worker processing lag",
    }
)
var ProxyRemoved = map[string]bool{}

ProxyRemoved is a set of module@version that have been removed from the proxy, even though they are still in the index.

type Fetcher Uses

type Fetcher struct {
    ProxyClient  *proxy.Client
    SourceClient *source.Client
    DB           *postgres.DB
}

A Fetcher holds state for fetching modules.

func (*Fetcher) FetchAndUpdateState Uses

func (f *Fetcher) FetchAndUpdateState(ctx context.Context, modulePath, requestedVersion, appVersionLabel string, disableProxyFetch bool) (_ int, resolvedVersion string, err error)

FetchAndUpdateState fetches and processes a module version, and then updates the module_version_states table according to the result. It returns an HTTP status code representing the result of the fetch operation, and a non-nil error if this status code is not 200.

type Server Uses

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

Server can be installed to serve the go discovery worker.

func NewServer Uses

func NewServer(cfg *config.Config, scfg ServerConfig) (_ *Server, err error)

NewServer creates a new Server with the given dependencies.

func (*Server) Install Uses

func (s *Server) Install(handle func(string, http.Handler))

Install registers server routes using the given handler registration func.

type ServerConfig Uses

type ServerConfig struct {
    DB               *postgres.DB
    IndexClient      *index.Client
    ProxyClient      *proxy.Client
    SourceClient     *source.Client
    RedisHAClient    *redis.Client
    RedisCacheClient *redis.Client
    Queue            queue.Queue
    ReportingClient  *errorreporting.Client
    StaticPath       template.TrustedSource
    GetExperiments   func() []*internal.Experiment
}

ServerConfig contains everything needed by a Server.

Package worker imports 41 packages (graph) and is imported by 1 packages. Updated 2021-01-16. Refresh now. Tools for package owners.