background

package
v0.1505.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RefreshReleasePeriod      = time.Hour * 24 * 7      // Once a week
	RefreshReleaseDatesPeriod = time.Hour * 24 * 7 * 30 // Once a month
)

Variables

View Source
var (
	Intention = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "gramophile_intention",
		Help: "The length of the working queue I think yes",
	}, []string{"intention"})
	MarkerCount = promauto.NewCounter(prometheus.CounterOpts{
		Name: "gramophile_marker_rejects",
		Help: "The length of the working queue I think yes",
	})
	Rintention = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "gramophile_queue_refresh_intention",
		Help: "The length of the working queue I think yes",
	}, []string{"intention"})
	TaskDuration = promauto.NewSummaryVec(prometheus.SummaryOpts{
		Name: "gramophile_task_duration",
		Help: "Duration of background tasks",
	}, []string{"type"})
	TaskResult = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "gramophile_task_result",
		Help: "Result of background tasks",
	}, []string{"type", "result"})
)

Functions

func EnqueueWithIgnore added in v0.1441.0

func EnqueueWithIgnore(ctx context.Context, req *pb.EnqueueRequest, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

Types

type BackgroundRunner

type BackgroundRunner struct {
	ReleaseRefresh int64
	// contains filtered or unexported fields
}

func GetBackgroundRunner added in v0.67.0

func GetBackgroundRunner(db db.Database, key, secret, callback string) *BackgroundRunner

func (*BackgroundRunner) AddFolder added in v0.297.0

func (b *BackgroundRunner) AddFolder(ctx context.Context, folderName string, d discogs.Discogs, u *pb.StoredUser) error

func (*BackgroundRunner) AddMasterWant added in v0.667.0

func (b *BackgroundRunner) AddMasterWant(ctx context.Context, d discogs.Discogs, want *pb.Want) error

func (*BackgroundRunner) AddSale added in v0.1186.0

func (b *BackgroundRunner) AddSale(ctx context.Context, d discogs.Discogs, iid int64, saleParams *pbd.SaleParams, user *pb.StoredUser) error

func (*BackgroundRunner) AdjustSales added in v0.317.0

func (b *BackgroundRunner) AdjustSales(ctx context.Context, c *pb.SaleConfig, user *pb.StoredUser, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) AlignDigitalWantlist added in v0.1306.0

func (b *BackgroundRunner) AlignDigitalWantlist(ctx context.Context, userid int32) error

func (*BackgroundRunner) AlignWants added in v0.606.0

func (b *BackgroundRunner) AlignWants(ctx context.Context, user *pb.StoredUser, c *pb.WantsConfig) error

Ensures everything is in a wantlist - only used when ORIGIN_GRAMOPHILE is set for wants

func (*BackgroundRunner) CleanCollection added in v0.249.0

func (b *BackgroundRunner) CleanCollection(ctx context.Context, d discogs.Discogs, refreshId int64, authToken string, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) CleanSales added in v0.550.0

func (b *BackgroundRunner) CleanSales(ctx context.Context, userid int32, refreshId int64) error

func (*BackgroundRunner) CullWants added in v0.465.0

func (b *BackgroundRunner) CullWants(ctx context.Context, d discogs.Discogs, sid int64) error

func (*BackgroundRunner) DeleteRecord added in v0.1420.0

func (b *BackgroundRunner) DeleteRecord(ctx context.Context, d discogs.Discogs, iid int64) error

func (*BackgroundRunner) Execute added in v0.1432.0

func (*BackgroundRunner) FanoutHistory added in v0.1146.0

func (b *BackgroundRunner) FanoutHistory(ctx context.Context, typ pb.UpdateType, user *pb.StoredUser, auth string, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) GetDeduplicationKey added in v0.1432.0

func (b *BackgroundRunner) GetDeduplicationKey(entry *pb.QueueElement) string

func (*BackgroundRunner) GetFormat added in v0.1133.0

func (b *BackgroundRunner) GetFormat(ctx context.Context, record *pb.Record, fc *pb.FormatClassifier) string
func (b *BackgroundRunner) HardLink(ctx context.Context, user *pb.StoredUser, records []*pb.Record, sales []*pb.SaleInfo) error

func (*BackgroundRunner) LinkSales added in v0.300.0

func (b *BackgroundRunner) LinkSales(ctx context.Context, user *pb.StoredUser) error

func (*BackgroundRunner) MoveRecord added in v0.1424.0

func (*BackgroundRunner) ProcessArrived added in v0.276.0

func (b *BackgroundRunner) ProcessArrived(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field, auth string, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) ProcessCollectionPage added in v0.67.0

func (b *BackgroundRunner) ProcessCollectionPage(ctx context.Context, d discogs.Discogs, page int32, refreshId int64) (int32, error)

func (*BackgroundRunner) ProcessGoalFolder added in v0.252.0

func (b *BackgroundRunner) ProcessGoalFolder(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field) error

func (*BackgroundRunner) ProcessIntents added in v0.119.0

func (b *BackgroundRunner) ProcessIntents(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, auth string, enqueue func(ctx context.Context, entry *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) ProcessKeep added in v0.297.0

func (b *BackgroundRunner) ProcessKeep(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field, auth string, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) ProcessListenDate added in v0.191.0

func (b *BackgroundRunner) ProcessListenDate(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field) error

func (*BackgroundRunner) ProcessPurchaseLocation added in v0.1147.0

func (b *BackgroundRunner) ProcessPurchaseLocation(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field) error

func (*BackgroundRunner) ProcessPurchasePrice added in v0.1147.0

func (b *BackgroundRunner) ProcessPurchasePrice(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field) error

func (*BackgroundRunner) ProcessRefreshCollectionEntry added in v0.1424.0

func (b *BackgroundRunner) ProcessRefreshCollectionEntry(ctx context.Context, d discogs.Discogs, user *pb.StoredUser, entry *pb.QueueElement, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) ProcessRefreshIntents added in v0.1424.0

func (b *BackgroundRunner) ProcessRefreshIntents(ctx context.Context, d discogs.Discogs, entry *pb.QueueElement, enqueue func(ctx context.Context, entry *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) ProcessRefreshRelease added in v0.1424.0

func (b *BackgroundRunner) ProcessRefreshRelease(ctx context.Context, u *pb.StoredUser, d discogs.Discogs, entry *pb.QueueElement, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) ProcessRefreshSales added in v0.1424.0

func (b *BackgroundRunner) ProcessRefreshSales(ctx context.Context, d discogs.Discogs, user *pb.StoredUser, entry *pb.QueueElement, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) ProcessRefreshState added in v0.1424.0

func (b *BackgroundRunner) ProcessRefreshState(ctx context.Context, d discogs.Discogs, entry *pb.QueueElement, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) ProcessRefreshWantlists added in v0.1424.0

func (b *BackgroundRunner) ProcessRefreshWantlists(ctx context.Context, d discogs.Discogs, authToken string, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) ProcessScore added in v0.380.0

func (b *BackgroundRunner) ProcessScore(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field) error

func (*BackgroundRunner) ProcessSetClean added in v0.119.0

func (b *BackgroundRunner) ProcessSetClean(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field) error

func (*BackgroundRunner) ProcessSetFolder added in v0.817.0

func (b *BackgroundRunner) ProcessSetFolder(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field) error

func (*BackgroundRunner) ProcessSetOversize added in v0.1126.0

func (b *BackgroundRunner) ProcessSetOversize(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field) error

func (*BackgroundRunner) ProcessSetWeight added in v0.241.0

func (b *BackgroundRunner) ProcessSetWeight(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field) error

func (*BackgroundRunner) ProcessSetWidth added in v0.215.0

func (b *BackgroundRunner) ProcessSetWidth(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field) error

func (*BackgroundRunner) ProcessSleeve added in v0.274.0

func (b *BackgroundRunner) ProcessSleeve(ctx context.Context, d discogs.Discogs, r *pb.Record, i *pb.Intent, user *pb.StoredUser, fields []*pbd.Field) error

func (*BackgroundRunner) ProcessSyncWants added in v0.1424.0

func (b *BackgroundRunner) ProcessSyncWants(ctx context.Context, d discogs.Discogs, user *pb.StoredUser, entry *pb.QueueElement, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) ProcessUpdateSale added in v0.1424.0

func (b *BackgroundRunner) ProcessUpdateSale(ctx context.Context, d discogs.Discogs, u *pb.StoredUser, entry *pb.UpdateSale) error

func (*BackgroundRunner) PullWants added in v0.465.0

func (b *BackgroundRunner) PullWants(ctx context.Context, d discogs.Discogs, page int32, sid int64, wc *pb.WantsConfig) (int32, error)

func (*BackgroundRunner) PurgeDigitalwantlist added in v0.1271.0

func (b *BackgroundRunner) PurgeDigitalwantlist(ctx context.Context, user *pb.StoredUser, userid int32) (*pb.Wantlist, error)

func (*BackgroundRunner) RecordHistory added in v0.1146.0

func (b *BackgroundRunner) RecordHistory(ctx context.Context, typ pb.UpdateType, userid, iid int64) error

func (*BackgroundRunner) RefreshCollection added in v0.421.0

func (b *BackgroundRunner) RefreshCollection(ctx context.Context, d discogs.Discogs, authToken string, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) RefreshRelease added in v0.421.0

func (b *BackgroundRunner) RefreshRelease(ctx context.Context, iid int64, u *pb.StoredUser, d discogs.Discogs, force bool) error

func (*BackgroundRunner) RefreshReleaseDate added in v0.446.0

func (b *BackgroundRunner) RefreshReleaseDate(ctx context.Context, u *pb.StoredUser, d discogs.Discogs, digWants bool, iid, rid int64, token string, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) RefreshReleaseDates added in v0.446.0

func (b *BackgroundRunner) RefreshReleaseDates(ctx context.Context, d discogs.Discogs, token string, iid, mid int64, digWants bool, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) RefreshState added in v0.775.0

func (b *BackgroundRunner) RefreshState(ctx context.Context, iid int64, d discogs.Discogs, force bool) error

func (*BackgroundRunner) RefreshUser

func (b *BackgroundRunner) RefreshUser(ctx context.Context, d discogs.Discogs, utoken string, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) RefreshWant added in v0.467.0

func (b *BackgroundRunner) RefreshWant(ctx context.Context, d discogs.Discogs, want *pb.Want, authToken string, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) RefreshWantInternal added in v0.852.0

func (b *BackgroundRunner) RefreshWantInternal(ctx context.Context, d discogs.Discogs, want *pb.Want, authToken string, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) (bool, error)

func (*BackgroundRunner) RefreshWantlists added in v0.304.0

func (b *BackgroundRunner) RefreshWantlists(ctx context.Context, d discogs.Discogs, authToken string, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) RefreshWants added in v0.467.0

func (b *BackgroundRunner) RefreshWants(ctx context.Context, d discogs.Discogs, auth string, enqueue func(ctx context.Context, req *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) RegisterAllHandlers added in v0.1432.0

func (b *BackgroundRunner) RegisterAllHandlers()

func (*BackgroundRunner) RegisterTaskHandler added in v0.1432.0

func (b *BackgroundRunner) RegisterTaskHandler(entryType string, handler TaskHandler)

func (*BackgroundRunner) RunMoves added in v0.318.0

func (b *BackgroundRunner) RunMoves(ctx context.Context, user *pb.StoredUser, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error

func (*BackgroundRunner) SyncSales added in v0.300.0

func (b *BackgroundRunner) SyncSales(ctx context.Context, d discogs.Discogs, page int32, id int64) (*pbd.Pagination, error)

func (*BackgroundRunner) UpdateSalePrice added in v0.317.0

func (b *BackgroundRunner) UpdateSalePrice(ctx context.Context, d discogs.Discogs, sid int64, releaseid int64, condition string, newprice int32, motivation string) error

func (*BackgroundRunner) Validate added in v0.1432.0

func (b *BackgroundRunner) Validate(ctx context.Context, entry *pb.QueueElement) error

type TaskHandler added in v0.1432.0

type TaskHandler interface {
	Execute(ctx context.Context, d discogs.Discogs, u *pb.StoredUser, entry *pb.QueueElement, enqueue func(context.Context, *pb.EnqueueRequest) (*pb.EnqueueResponse, error)) error
	Validate(ctx context.Context, db db.Database, entry *pb.QueueElement) error
	GetDeduplicationKey(entry *pb.QueueElement) string
}

Jump to

Keyboard shortcuts

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