cleaner

package
v0.12.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cleaner

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

func New

func New(state *state.State) *Cleaner

func (*Cleaner) Emoji

func (c *Cleaner) Emoji() *Emoji

Emoji returns the emoji set of cleaner utilities.

func (*Cleaner) Media

func (c *Cleaner) Media() *Media

Media returns the media set of cleaner utilities.

type Emoji

type Emoji struct {
	*Cleaner
}

Emoji encompasses a set of emoji cleanup / admin utils.

func (*Emoji) All

func (e *Emoji) All(ctx context.Context, maxRemoteDays int)

All will execute all cleaner.Emoji utilities synchronously, including output logging. Context will be checked for `gtscontext.DryRun()` in order to actually perform the action.

func (*Emoji) FixBroken

func (e *Emoji) FixBroken(ctx context.Context) (int, error)

FixBroken will check all emojis for valid related models (e.g. category). Broken media will be automatically updated to remove now-missing models. Context will be checked for `gtscontext.DryRun()` to perform the action.

func (*Emoji) FixCacheStates added in v0.11.0

func (e *Emoji) FixCacheStates(ctx context.Context) (int, error)

FixCacheStatus will check all emoji for up-to-date cache status (i.e. in storage driver). Context will be checked for `gtscontext.DryRun()` to perform the action. NOTE: this function should be updated to match media.FixCacheStat() if we ever support emoji uncaching.

func (*Emoji) LogFixBroken

func (e *Emoji) LogFixBroken(ctx context.Context)

LogFixBroken performs Emoji.FixBroken(...), logging the start and outcome.

func (*Emoji) LogFixCacheStates added in v0.11.0

func (e *Emoji) LogFixCacheStates(ctx context.Context)

LogFixCacheStates performs Emoji.FixCacheStates(...), logging the start and outcome.

func (*Emoji) LogPruneUnused added in v0.11.0

func (e *Emoji) LogPruneUnused(ctx context.Context)

LogPruneUnused performs Emoji.PruneUnused(...), logging the start and outcome.

func (*Emoji) LogUncacheRemote added in v0.11.0

func (e *Emoji) LogUncacheRemote(ctx context.Context, olderThan time.Time)

LogUncacheRemote performs Emoji.UncacheRemote(...), logging the start and outcome.

func (*Emoji) PruneUnused added in v0.11.0

func (e *Emoji) PruneUnused(ctx context.Context) (int, error)

PruneUnused will delete all unused emoji media from the database and storage driver. Context will be checked for `gtscontext.DryRun()` to perform the action. NOTE: this function should be updated to match media.FixCacheStat() if we ever support emoji uncaching.

func (*Emoji) UncacheRemote added in v0.11.0

func (e *Emoji) UncacheRemote(ctx context.Context, olderThan time.Time) (int, error)

UncacheRemote will uncache all remote emoji older than given input time. Context will be checked for `gtscontext.DryRun()` in order to actually perform the action.

type Media

type Media struct {
	*Cleaner
}

Media encompasses a set of media cleanup / admin utils.

func (*Media) All

func (m *Media) All(ctx context.Context, maxRemoteDays int)

All will execute all cleaner.Media utilities synchronously, including output logging. Context will be checked for `gtscontext.DryRun()` in order to actually perform the action.

func (*Media) FixCacheStates

func (m *Media) FixCacheStates(ctx context.Context) (int, error)

FixCacheStatus will check all media for up-to-date cache status (i.e. in storage driver). Media marked as cached, with any required files missing, will be automatically uncached. Context will be checked for `gtscontext.DryRun()` in order to actually perform the action.

func (*Media) LogFixCacheStates

func (m *Media) LogFixCacheStates(ctx context.Context)

LogFixCacheStates performs Media.FixCacheStates(...), logging the start and outcome.

func (*Media) LogPruneOrphaned

func (m *Media) LogPruneOrphaned(ctx context.Context)

LogPruneOrphaned performs Media.PruneOrphaned(...), logging the start and outcome.

func (*Media) LogPruneUnused

func (m *Media) LogPruneUnused(ctx context.Context)

LogPruneUnused performs Media.PruneUnused(...), logging the start and outcome.

func (*Media) LogUncacheRemote

func (m *Media) LogUncacheRemote(ctx context.Context, olderThan time.Time)

LogUncacheRemote performs Media.UncacheRemote(...), logging the start and outcome.

func (*Media) PruneOrphaned

func (m *Media) PruneOrphaned(ctx context.Context) (int, error)

PruneOrphaned will delete orphaned files from storage (i.e. media missing a database entry). Context will be checked for `gtscontext.DryRun()` in order to actually perform the action.

func (*Media) PruneUnused

func (m *Media) PruneUnused(ctx context.Context) (int, error)

PruneUnused will delete all unused media attachments from the database and storage driver. Media is marked as unused if not attached to any status, account or account is suspended. Context will be checked for `gtscontext.DryRun()` in order to actually perform the action.

func (*Media) UncacheRemote

func (m *Media) UncacheRemote(ctx context.Context, olderThan time.Time) (int, error)

UncacheRemote will uncache all remote media attachments older than given input time. Context will be checked for `gtscontext.DryRun()` in order to actually perform the action.

Jump to

Keyboard shortcuts

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