Package database is a database interface for mirror settings.



    This section is empty.


    This section is empty.


    This section is empty.


    type MirrorDB

    type MirrorDB struct {
    	// contains filtered or unexported fields

    func New

    func New(db *database.DB) *MirrorDB

    func (*MirrorDB) AddMirror

    func (db *MirrorDB) AddMirror(ctx context.Context, m *model.Mirror) error

    func (*MirrorDB) DeleteMirror

    func (db *MirrorDB) DeleteMirror(ctx context.Context, m *model.Mirror) error

    func (*MirrorDB) GetMirror

    func (db *MirrorDB) GetMirror(ctx context.Context, id int64) (*model.Mirror, error)

      GetMirror retruns the mirror with the given ID.

      func (*MirrorDB) ListFiles

      func (db *MirrorDB) ListFiles(ctx context.Context, mirrorID int64) ([]*model.MirrorFile, error)

      func (*MirrorDB) Mirrors

      func (db *MirrorDB) Mirrors(ctx context.Context) ([]*model.Mirror, error)

        Mirrors returns the list of mirrors for the database, ordered by id.

        func (*MirrorDB) SaveFiles

        func (db *MirrorDB) SaveFiles(ctx context.Context, mirrorID int64, filenames []*SyncFile) error

          SaveFiles makes the list of filenames passed in the only files that are saved on that mirrorID. filenames is a map of the upstream->local filenames. They may be the same.

          func (*MirrorDB) UpdateMirror

          func (db *MirrorDB) UpdateMirror(ctx context.Context, m *model.Mirror) error

            UpdateMirror updates the given mirror struct in the database. It must already exist in the database, keyed off of ID.

            type SyncFile

            type SyncFile struct {
            	// RemoteFile is the ONLY the final filename (last part after the slash) with
            	// extension. It does not include the URL, protocol or root information as
            	// that is built from the parent mirror record.
            	RemoteFile string
            	// LocalFile is blank unless a rewrite rule was provided. It is also just the
            	// filename (no URL or protocol information).
            	LocalFile string

            Source Files