tool

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadHashes

func LoadHashes(file string) ([]string, error)

LoadHashes loads siva hashes from a file and generates a list. The lines from the file are parsed so it accepts file lists with bucketing. This list is filtered so it does not contain repetitions and is sorted n lexicographic order.

func LoadList

func LoadList(file string) ([]string, error)

LoadList calls LoadListFilter with an empty filter.

func LoadListFilter

func LoadListFilter(file string, filter func(string) string) ([]string, error)

LoadListFilter loads a list of strings, applies a filter function to each line, removes duplicates and returns it sorted lexicographically.

func OpenFS

func OpenFS(conn string) (billy.Basic, error)

OpenFS creates a billy filesystem from a connection string. Only osfs and gluster are supported. gluster connection string has this syntax:

gluster://<host>/<volume>[/<path>]

If path is provided a chroot is returned to that path.

Types

type Database

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

Database has the db functionality used by the tool.

func NewDatabase

func NewDatabase(db *sql.DB) *Database

NewDatabase creates and initializes a new Database struct.

func (*Database) DeleteReferences

func (d *Database) DeleteReferences(ctx context.Context, init string) error

DeleteReferences removes all references hold in an init.

func (*Database) ReferencesWithInit

func (d *Database) ReferencesWithInit(init string) ([]*model.Reference, error)

ReferencesWithInit returns all references with an specific init.

func (*Database) RepositoriesWithInit

func (d *Database) RepositoriesWithInit(init string) ([]string, error)

RepositoriesWithInit returns all repositories with references to a specific init.

func (*Database) Repository

func (d *Database) Repository(id string) (*model.Repository, error)

Repository finds and returns a repo by ID.

func (*Database) Siva

func (d *Database) Siva() ([]string, error)

Siva returns all siva files used by references.

type Repository

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

Repository has the information to manage repositories in the database and message queue.

func NewRepository

func NewRepository(db *Database, q queue.Queue) *Repository

NewRepository creates and initializes a new Repository struct.

func (*Repository) Cancel

func (w *Repository) Cancel()

func (*Repository) DefaultErrors

func (w *Repository) DefaultErrors(msg string, skipErrors bool)

func (*Repository) Dry

func (w *Repository) Dry(d bool)

func (*Repository) Errors

func (w *Repository) Errors(f func(error))

func (*Repository) Priority

func (r *Repository) Priority(p queue.Priority)

Priority sets the priority level for new queued jobs.

func (*Repository) Queue

func (r *Repository) Queue(ctx context.Context, list []string) error

Queue creates new jobs for the repositories in the provided list. It skips repositories that are not in a queueable state, by default Fetched or Fetching. After submitting the job the repository is set to Pending state.

func (*Repository) QueueOne

func (r *Repository) QueueOne(id string) error

QueueOne queues one repository.

func (*Repository) Retries

func (r *Repository) Retries(c int32)

Retries sets the retries value used in new queued jobs.

func (*Repository) SkipErrors

func (w *Repository) SkipErrors(e bool)

func (*Repository) Workers

func (w *Repository) Workers(n int)

type Set

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

func NewSet

func NewSet(threadSafe bool) *Set

func (*Set) Add

func (s *Set) Add(name string)

func (*Set) Contains

func (s *Set) Contains(name string) bool

func (*Set) List

func (s *Set) List() []string

type Siva

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

Siva deals with siva files and its database usage.

func NewSiva

func NewSiva(db *Database, fs billy.Basic) *Siva

NewSiva creates and initializes a new Siva struct.

func (*Siva) Bucket

func (s *Siva) Bucket(b int)

Bucket sets the bucket size for siva files.

func (*Siva) Cancel

func (w *Siva) Cancel()

func (*Siva) DefaultErrors

func (w *Siva) DefaultErrors(msg string, skipErrors bool)

func (*Siva) Delete

func (s *Siva) Delete(ctx context.Context, list []string) error

Delete removes all references to the siva files in a list, deletes its siva file and calls queue function for its repositories.

func (*Siva) DeleteOne

func (s *Siva) DeleteOne(ctx context.Context, init string) error

DeleteOne deletes one siva file, its references and calls queue function for the related repositories.

func (*Siva) Dry

func (w *Siva) Dry(d bool)

func (*Siva) Errors

func (w *Siva) Errors(f func(error))

func (*Siva) Failed

func (s *Siva) Failed(req func(string) error)

Failed sets the function used to save failed jobs.

func (*Siva) Queue

func (s *Siva) Queue(req func(string) error)

Queue sets the function used to queue repositories.

func (*Siva) Rebucket

func (s *Siva) Rebucket(ctx context.Context, list []string, to int) error

Rebucket changes bucketing level from a list of siva files.

func (*Siva) RebucketOne

func (s *Siva) RebucketOne(ctx context.Context, f string, to int) error

RebucketOne changes one siva file bucketing level.

func (*Siva) SkipErrors

func (w *Siva) SkipErrors(e bool)

func (*Siva) Workers

func (w *Siva) Workers(n int)

func (*Siva) WriteFailed

func (s *Siva) WriteFailed(writer io.Writer)

WriteFailed sets a default function that writes to writer each failed job.

func (*Siva) WriteQueue

func (s *Siva) WriteQueue(writer io.Writer)

WriteQueue sets a default function that writes to writer each repository id that has to be queued.

Jump to

Keyboard shortcuts

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