util

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrReadOnlyStorer = errors.NewKind("storer in read-only mode")

ErrReadOnlyStorer error returns when a write method is used in a ReadOnlyStorer.

Functions

func ForEachLibraryIterator

func ForEachLibraryIterator(iter borges.LibraryIterator, cb func(borges.Library) error) error

ForEachLibraryIterator is a helper function to build iterators without need to rewrite the same ForEach function each time.

func ForEachLocatorIterator

func ForEachLocatorIterator(iter borges.LocationIterator, cb func(borges.Location) error) error

ForEachLocatorIterator is a helper function to build iterators without need to rewrite the same ForEach function each time.

func ForEachRepositoryIterator

func ForEachRepositoryIterator(iter borges.RepositoryIterator, cb func(borges.Repository) error) error

ForEachRepositoryIterator is a helper function to build iterators without need to rewrite the same ForEach function each time.

Types

type LibraryIterator

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

LibraryIterator iterates a list of borges.Library.

func NewLibraryIterator

func NewLibraryIterator(libs []borges.Library) *LibraryIterator

NewLibraryIterator returns a LibraryIterator based on a list of libraries.

func (*LibraryIterator) Close

func (iter *LibraryIterator) Close()

Close releases any resources used by the iterator.

func (*LibraryIterator) ForEach

func (iter *LibraryIterator) ForEach(cb func(borges.Library) error) error

ForEach call the function for each object contained on this iter until an error happens or the end of the iter is reached. If ErrStop is sent the iteration is stop but no error is returned. The iterator is closed.

func (*LibraryIterator) Next

func (iter *LibraryIterator) Next() (borges.Library, error)

Next returns the next location from the iterator. If the iterator has reached the end it will return io.EOF as an error.

type LocationIterator

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

LocationIterator iterates a list of borges.Location.

func NewLocationIterator

func NewLocationIterator(locs []borges.Location) *LocationIterator

NewLocationIterator returns a LocationIterator based on a list of locations.

func (*LocationIterator) Close

func (iter *LocationIterator) Close()

Close releases any resources used by the iterator.

func (*LocationIterator) ForEach

func (iter *LocationIterator) ForEach(cb func(borges.Location) error) error

ForEach call the function for each object contained on this iter until an error happens or the end of the iter is reached. If ErrStop is sent the iteration is stop but no error is returned. The iterator is closed.

func (*LocationIterator) Next

func (iter *LocationIterator) Next() (borges.Location, error)

Next returns the next location from the iterator. If the iterator has reached the end it will return io.EOF as an error.

type LocationRepositoryIterator

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

LocationRepositoryIterator iterates the repositories from a list of borges.Location.

func NewLocationRepositoryIterator

func NewLocationRepositoryIterator(locs []borges.Location, mode borges.Mode) *LocationRepositoryIterator

NewLocationRepositoryIterator returns a new borges.RepositoryIterator from a list of borges.Location.

func (*LocationRepositoryIterator) Close

func (iter *LocationRepositoryIterator) Close()

Close releases any resources used by the iterator.

func (*LocationRepositoryIterator) ForEach

func (iter *LocationRepositoryIterator) ForEach(cb func(borges.Repository) error) error

ForEach call the function for each object contained on this iter until an error happens or the end of the iter is reached. If ErrStop is sent the iteration is stop but no error is returned. The iterator is closed.

func (*LocationRepositoryIterator) Next

func (iter *LocationRepositoryIterator) Next() (borges.Repository, error)

Next returns the next repository from the iterator. If the iterator has reached the end it will return io.EOF as an error.

type ReadOnlyStorer

type ReadOnlyStorer struct {
	storage.Storer
}

ReadOnlyStorer it's a storer that simply fails when you try to do any kind of write operation over the storer.

func (*ReadOnlyStorer) CheckAndSetReference

func (s *ReadOnlyStorer) CheckAndSetReference(new *plumbing.Reference, old *plumbing.Reference) error

CheckAndSetReference honors the storage.Storer interface. It fails with a ErrReadOnlyStorer when is called.

func (*ReadOnlyStorer) SetConfig

func (s *ReadOnlyStorer) SetConfig(*config.Config) error

SetConfig honors the storage.Storer interface. It fails with a ErrReadOnlyStorer when is called.

func (*ReadOnlyStorer) SetEncodedObject

func (s *ReadOnlyStorer) SetEncodedObject(plumbing.EncodedObject) (plumbing.Hash, error)

SetEncodedObject honors the storage.Storer interface. It fails with a ErrReadOnlyStorer when is called.

func (*ReadOnlyStorer) SetIndex

func (s *ReadOnlyStorer) SetIndex(*index.Index) error

SetIndex honors the storage.Storer interface. It fails with a ErrReadOnlyStorer when is called.

func (*ReadOnlyStorer) SetReference

func (s *ReadOnlyStorer) SetReference(*plumbing.Reference) error

SetReference honors the storage.Storer interface. It fails with a ErrReadOnlyStorer when is called.

func (*ReadOnlyStorer) SetShallow

func (s *ReadOnlyStorer) SetShallow([]plumbing.Hash) error

SetShallow honors the storage.Storer interface. It fails with a ErrReadOnlyStorer when is called.

Jump to

Keyboard shortcuts

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