Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllDocsResponse ¶
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 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 (*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 ¶
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