database

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package database is a database interface for mirror settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 added in v0.17.0

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 added in v0.17.0

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 added in v0.16.1

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
}

Jump to

Keyboard shortcuts

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