Documentation

Overview

    Package legacysiva implements a go-borges library that uses siva files as its storage backend. It has a 1-to-1 matching of locations and repositories and no filtering or conversion is done to its references or objects.

    It's meant to be used with siva files generated by borges. It's also a read only implementation and does not support transactionality.

    Example
    Output:
    
    location: 3974996807a9f596cf25ac3a714995c24bb97e2c, id refs/heads/HEAD/016b92d2-5b60-cbf8-a7d8-f0e0c6832d91, head: ce1e0703402e989bedf03d5df535401340f54b42
    location: 3974996807a9f596cf25ac3a714995c24bb97e2c, id refs/heads/HEAD/016b92d2-5b62-e877-df42-887c21e354bd, head: ce1e0703402e989bedf03d5df535401340f54b42
    location: 3974996807a9f596cf25ac3a714995c24bb97e2c, id refs/heads/HEAD/016b92d2-5b68-4376-da62-9bd3f44ccdf7, head: ce1e0703402e989bedf03d5df535401340f54b42
    location: f2cee90acf3c6644d51a37057845b98ab1580932, id refs/heads/HEAD/016b92d2-5b58-9c19-84e5-ec45469a57ec, head: 4de1a2d995bc79d6e39bef647accbde6bec9093f
    location: f2cee90acf3c6644d51a37057845b98ab1580932, id refs/heads/HEAD/016b92d2-5b5c-8dac-2ae6-6437e11dad17, head: 38aec3212d377ae36b72fcc068f57e7a6344c5d4
    location: f2cee90acf3c6644d51a37057845b98ab1580932, id refs/heads/HEAD/016b92d2-5b5e-2925-a091-7cdb57ab3c5e, head: 38aec3212d377ae36b72fcc068f57e7a6344c5d4
    

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type Library

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

      Library represents a borges.Library implementation based on siva files archiving rooted repositories using an old structure. See https://github.com/src-d/borges/blob/master/docs/using-borges/key-concepts.md#rooted-repository. It only supports read operations on the repositories and it doesn't support transactionality. Each siva file is managed as a single repository.

      func NewLibrary

      func NewLibrary(
      	id string,
      	fs billy.Filesystem,
      	options *LibraryOptions,
      ) (*Library, error)

        NewLibrary builds a new Library.

        func (*Library) Get

        func (l *Library) Get(
        	id borges.RepositoryID,
        	_ borges.Mode,
        ) (borges.Repository, error)

          Get implements the borges.Library interface. It only retrieves repositories in borges.ReadOnlyMode ignoring the given parameter.

          func (*Library) GetOrInit

          func (l *Library) GetOrInit(_ borges.RepositoryID) (borges.Repository, error)

            GetOrInit implements the borges.Library interface.

            func (*Library) Has

            func (l *Library) Has(
            	id borges.RepositoryID,
            ) (bool, borges.LibraryID, borges.LocationID, error)

              Has implements the borges.Library interface.

              func (*Library) ID

              func (l *Library) ID() borges.LibraryID

                ID implements the borges.Library interface.

                func (*Library) Init

                func (l *Library) Init(id borges.RepositoryID) (borges.Repository, error)

                  Init implements the borges.Library interface.

                  func (*Library) Location

                  func (l *Library) Location(id borges.LocationID) (borges.Location, error)

                    Location implements the borges.Library interface.

                    func (*Library) Locations

                    func (l *Library) Locations() (borges.LocationIterator, error)

                      Locations implements the borges.Library interface.

                      func (*Library) Repositories

                      func (l *Library) Repositories(
                      	_ borges.Mode,
                      ) (borges.RepositoryIterator, error)

                        Repositories implements the borges.Library interface. It only retrieves repositories in borges.ReadOnlyMode ignoring the given parameter.

                        type LibraryOptions

                        type LibraryOptions struct {
                        	// RegistryCache is the maximum number of locations in the cache. A
                        	// value of 0 will be set a default value of 10000.
                        	RegistryCache int
                        	// Bucket level to use to search and create siva files.
                        	Bucket int
                        	// Cache specifies the shared cache used in repositories. If not defined
                        	// a new default cache will be created for each repository.
                        	Cache cache.Object
                        	// Timeout set a timeout for library operations. Some operations could
                        	// potentially take long so timing out them will make an error be
                        	// returned. A 0 value sets a default value of 20 seconds.
                        	Timeout time.Duration
                        }

                          LibraryOptions hold configuration options for the library.

                          type Location

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

                            Location represents a siva file archiving several git repositories using an old rooted repository structure see https://github.com/src-d/borges/blob/master/docs/using-borges/key-concepts.md#rooted-repository.

                            func (*Location) Get

                            func (l *Location) Get(
                            	id borges.RepositoryID, _ borges.Mode,
                            ) (borges.Repository, error)

                              Get implements the borges.Location interface. It only retrieves repositories in borges.ReadOnlyMode ignoring the given parameter.

                              func (*Location) GetOrInit

                              func (l *Location) GetOrInit(_ borges.RepositoryID) (borges.Repository, error)

                                GetOrInit implements the borges.Location interface.

                                func (*Location) Has

                                func (l *Location) Has(id borges.RepositoryID) (bool, error)

                                  Has implements the borges.Location interface.

                                  func (*Location) ID

                                  func (l *Location) ID() borges.LocationID

                                    ID implements the borges.Location interface.

                                    func (*Location) Init

                                    func (l *Location) Init(_ borges.RepositoryID) (borges.Repository, error)

                                      Init implements the borges.Location interface.

                                      func (*Location) Library

                                      func (l *Location) Library() borges.Library

                                        Library implements the borges.Location interface.

                                        func (*Location) Repositories

                                        func (l *Location) Repositories(
                                        	_ borges.Mode,
                                        ) (borges.RepositoryIterator, error)

                                          Repositories implements the borges.Location interface. It only retrieves repositories in borges.ReadOnlyMode ignoring the given parameter.

                                          type Repository

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

                                            Repository is an implementation of borges.Repository interface based on siva files archiving rooted repositories using an old structure. See https://github.com/src-d/borges/blob/master/docs/using-borges/key-concepts.md#rooted-repository. It only supports read operations on the repositories and it doesn't support transactionality.

                                            func (*Repository) Close

                                            func (r *Repository) Close() error

                                              Close implements the borges.Repository interface.

                                              func (*Repository) Commit

                                              func (r *Repository) Commit() error

                                                Commit implements the borges.Repository interface. It always returns an borges.ErrNonTransactional error.

                                                func (*Repository) FS

                                                func (r *Repository) FS() billy.Filesystem

                                                  FS implements the borges.Repository interface.

                                                  func (*Repository) ID

                                                  func (r *Repository) ID() borges.RepositoryID

                                                    ID implements the borges.Repository interface.

                                                    func (*Repository) Location

                                                    func (r *Repository) Location() borges.Location

                                                      Location implements the borges.Repository interface.

                                                      func (*Repository) Mode

                                                      func (r *Repository) Mode() borges.Mode

                                                        Mode implements the borges.Repository interface. It always returns borges.ReadOnlyMode.

                                                        func (*Repository) R

                                                        func (r *Repository) R() *git.Repository

                                                          R implements the borges.Repository interface.