v1

package
v0.0.0-...-c71443c Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "1.0.0"

Version is the version of ferryd

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a client for the V1 API

func NewClient

func NewClient(address string) *Client

NewClient will return a new ClientV1 for the local unix socket, suitable for communicating with the daemon.

func (*Client) Check

func (c *Client) Check(id string) (d *repo.Diff, j *jobs.Job, err error)

Check will compare a repo on disk with the DB

func (*Client) CherryPick

func (c *Client) CherryPick(left, right, pkg string) (d *repo.Diff, j *jobs.Job, err error)

CherryPick will ask the backend to sync a single package from one repo to another

func (*Client) Clone

func (c *Client) Clone(src, dest string) (s *repo.Summary, j *jobs.Job, err error)

Clone will ask the backend to clone an existing repository into a new repository

func (*Client) Close

func (c *Client) Close()

Close will kill any idle connections still in "keep-alive" and ensure we're not leaking file descriptors.

func (*Client) Compare

func (c *Client) Compare(left, right string) (d *repo.Diff, j *jobs.Job, err error)

Compare will ask the backend to compare one repo to another

func (*Client) Create

func (c *Client) Create(id string, instant bool) (j *jobs.Job, err error)

Create will attempt to create a repository in the daemon

func (*Client) Delta

func (c *Client) Delta(id string) (d *repo.Diff, j *jobs.Job, err error)

Delta will generate missing metas in a given repo

func (*Client) GetJob

func (c *Client) GetJob(id int) (j *jobs.Job, err error)

GetJob will request current information about a Job

func (*Client) Import

func (c *Client) Import(id string, instant bool) (r *repo.Summary, j *jobs.Job, err error)

Import will ask ferryd to import a repository from disk

func (*Client) Index

func (c *Client) Index(id string) (j *jobs.Job, err error)

Index will attempt to index a repository in the daemon

func (*Client) Remove

func (c *Client) Remove(id string) (j *jobs.Job, err error)

Remove will attempt to remove a repository in the daemon

func (*Client) Repos

func (c *Client) Repos() (f repo.FullSummary, err error)

Repos will grab a list of repos from the daemon

func (*Client) Rescan

func (c *Client) Rescan(id string) (d *repo.Diff, j *jobs.Job, err error)

Rescan will ask ferryd to re-import a repository from disk

func (*Client) ResetCompleted

func (c *Client) ResetCompleted() error

ResetCompleted asks the daemon to reset completed jobs

func (*Client) ResetFailed

func (c *Client) ResetFailed() error

ResetFailed asks the daemon to reset failed jobs

func (*Client) ResetQueued

func (c *Client) ResetQueued() error

ResetQueued asks the daemon to reset queued jobs

func (*Client) Status

func (c *Client) Status() (status StatusResponse, err error)

Status retrieves the status of the ferryd service

func (*Client) Sync

func (c *Client) Sync(src, dst string) (d *repo.Diff, j *jobs.Job, err error)

Sync will ask the backend to sync one repo to another

func (*Client) TrimObsoletes

func (c *Client) TrimObsoletes(id string) (d *repo.Diff, j *jobs.Job, err error)

TrimObsoletes will request that all packages marked obsolete are removed

func (*Client) TrimPackages

func (c *Client) TrimPackages(id string, maxKeep int) (d *repo.Diff, j *jobs.Job, err error)

TrimPackages will request that packages in the repo are trimmed to maxKeep

type GenericResponse

type GenericResponse struct {
	// Errors is a list of errors encountered in this transaction
	Errors []string `json:"errors"`
}

GenericResponse is a catchall for API responses

func (GenericResponse) Print

func (resp GenericResponse) Print(out io.Writer)

Print prints out a list of errors, one by one

type Listener

type Listener struct {

	// If systemd is enabled, we'll talk to it.
	SystemdEnabled bool
	// contains filtered or unexported fields
}

Listener sits on a unix socket accepting connections from authenticated client, i.e. root or those in the "ferry" group

func NewListener

func NewListener(store *jobs.Store, mgr *manager.Manager) (api *Listener, err error)

NewListener will return a newly initialised Server which is currently unbound

func (*Listener) Bind

func (api *Listener) Bind() error

Bind will attempt to set up the listener on the unix socket prior to serving.

func (*Listener) CherryPickRepo

func (l *Listener) CherryPickRepo(ctx *fasthttp.RequestCtx)

CherryPickRepo will ask the backend to sync a single package from one repo to another

func (*Listener) Close

func (api *Listener) Close()

Close will shut down and cleanup the socket

func (*Listener) CompareRepo

func (l *Listener) CompareRepo(ctx *fasthttp.RequestCtx)

CompareRepo will ask the backend to compare one repo to another

func (*Listener) CreateRepo

func (l *Listener) CreateRepo(ctx *fasthttp.RequestCtx)

CreateRepo will handle remote requests for repository creation

func (*Listener) GetJob

func (l *Listener) GetJob(ctx *fasthttp.RequestCtx)

GetJob handles request the current information about a Job

func (*Listener) ModifyDaemon

func (l *Listener) ModifyDaemon(ctx *fasthttp.RequestCtx)

ModifyDaemon makes a requested change to the daemon

func (*Listener) ModifyRepo

func (l *Listener) ModifyRepo(ctx *fasthttp.RequestCtx)

ModifyRepo performs a modification to an existing repo

func (*Listener) RemoveRepo

func (l *Listener) RemoveRepo(ctx *fasthttp.RequestCtx)

RemoveRepo will handle remote requests for repository deletion

func (*Listener) Repos

func (l *Listener) Repos(ctx *fasthttp.RequestCtx)

Repos will attempt to serialise our known repositories into a response

func (*Listener) ResetJobs

func (l *Listener) ResetJobs(ctx *fasthttp.RequestCtx)

ResetJobs will ask the job store to remove jobs of a certain status

func (*Listener) Start

func (api *Listener) Start() error

Start will continuously serve on the unix socket until dead

func (*Listener) Status

func (l *Listener) Status(ctx *fasthttp.RequestCtx)

Status will return the current status of the ferryd instance

func (*Listener) SyncRepo

func (l *Listener) SyncRepo(ctx *fasthttp.RequestCtx)

SyncRepo will ask the backend to sync one repo to another

type StatusResponse

type StatusResponse struct {
	GenericResponse
	// TimeStarted is the time when the daemon was last started
	TimeStarted time.Time `json:"time_started"`
	// Version is the version of the daemon
	Version string `json:"version"`
	// CurrentJobs is a list of running and queued jobs
	Current jobs.List `json:"current"`
	// FailedJobs is a list of failed jobs
	Failed jobs.List `json:"failed"`
	// CompletedJobs is a list of completed jobs
	Completed jobs.List `json:"completed"`
}

StatusResponse is a response from the 'status' endpoint

func (StatusResponse) Print

func (s StatusResponse) Print(out io.Writer)

Print writes out a StatusResponse

func (StatusResponse) Uptime

func (s StatusResponse) Uptime() time.Duration

Uptime will determine the uptime of the daemon

Jump to

Keyboard shortcuts

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