npm

package
v0.0.0-...-b202129 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllDocsResponse

type AllDocsResponse struct {
	TotalRows int       `json:"total_rows"`
	Offset    int       `json:"offset"`
	Sequence  int       `json:"update_seq"`
	Rows      []docsRow `json:"rows"`
}

type ChangesResponse

type ChangesResponse struct {
	Results      []changesResult `json:"results"`
	LastSequence int             `json:"last_seq"`
}

type DocumentResponse

type DocumentResponse struct {
	ID       string `json:"_id"`
	Revision string `json:"_rev"`
	Name     string `json:"name"`
}

DocumentResponse defines the form of registry document

This omits some fields in the document in order to provide informations that are important for use

type MirrorClient

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

func NewMirrorClient

func NewMirrorClient(db *db.PocketBase, config *MirrorConfig) *MirrorClient

NewMirrorClient creates an instance of MirrorClient

func (*MirrorClient) Check

func (c *MirrorClient) Check()

func (*MirrorClient) FirstRun

func (c *MirrorClient) FirstRun()

func (*MirrorClient) Run

func (c *MirrorClient) Run(onetime bool)

func (*MirrorClient) Start

func (c *MirrorClient) Start()

func (*MirrorClient) Update

func (c *MirrorClient) Update()

type MirrorConfig

type MirrorConfig struct {
	Registry       string `toml:"registry"`
	MaxConnections int    `toml:"concurrency"`
	Path           string `toml:"path"`
	Interval       int    `toml:"interval"`
}

type MirrorWorkResult

type MirrorWorkResult struct {
	Package          *db.BarePackage
	DocumentRevision string
	Document         string
	Distributions    []*distribution
	WorkerID         int
	Deleted          bool
}

MirrorWorkResult contains the result of worker action

type MirrorWorker

type MirrorWorker struct {
	ID          int
	Work        chan *db.BarePackage
	WorkerQueue chan chan *db.BarePackage
	ResultQueue chan *MirrorWorkResult
	WaitGroup   *sync.WaitGroup
	QuitChan    chan bool
	// contains filtered or unexported fields
}

MirrorWorker contains channels used to act as a worker

func NewMirrorWorker

func NewMirrorWorker(id int, npmClient *NPMClient, workerQueue chan chan *db.BarePackage, resultQueue chan *MirrorWorkResult, wg *sync.WaitGroup) *MirrorWorker

NewMirrorWorker creates a worker with given parameters

func (*MirrorWorker) Start

func (w *MirrorWorker) Start()

Start method starts the worker by starting a goroutine

func (*MirrorWorker) Stop

func (w *MirrorWorker) Stop()

Stop function tells the worker to stop listening for work requests

Note that the worker will only stop after it has finished its work

type NPMClient

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

func NewNPMClient

func NewNPMClient(registry string, path string) *NPMClient

func (*NPMClient) Download

func (c *NPMClient) Download(url *url.URL, shasum string) bool

func (*NPMClient) GetAllDocs

func (c *NPMClient) GetAllDocs() *AllDocsResponse

GetAllDocs returns a list of npm packages

func (*NPMClient) GetChangesSince

func (c *NPMClient) GetChangesSince(seq int) *ChangesResponse

func (*NPMClient) GetDocument

func (c *NPMClient) GetDocument(id string) string

type PocketServer

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

PocketServer type contains essential shared items to run a npm server

func NewPocketServer

func NewPocketServer(db *db.PocketBase, serverConfig *ServerConfig, mirrorConfig *MirrorConfig) *PocketServer

NewPocketServer initializes new instance of PocketServer

func (*PocketServer) Run

func (server *PocketServer) Run()

Run runs server

type ServerConfig

type ServerConfig struct {
	Bind         string `toml:"bind"`
	Scheme       string `toml:"scheme"`
	Host         string `toml:"host"`
	Port         int    `toml:"port"`
	EnableXAccel bool   `toml:"x_accel_redirect"`
	LogPath      string `toml:"logpath"`
}

Jump to

Keyboard shortcuts

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