store

package
v1.0.1-0...-ec039c9 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package store provides a store for the youtube service metadata

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltDB

type BoltDB struct {
	*bolt.DB
	Channels []string // the list of configured channels ids
}

BoltDB store for metadata related to downloaded YouTube audio.

func (*BoltDB) CheckProcessed

func (s *BoltDB) CheckProcessed(entry feed.Entry) (found bool, ts time.Time, err error)

CheckProcessed get processed status and returns timestamp for a given channel+video returns found=true if was set before and also the timestamp from stored entry.Published

func (*BoltDB) CountProcessed

func (s *BoltDB) CountProcessed() (count int)

CountProcessed returns the number of processed entries stored in processedBkt

func (*BoltDB) Exist

func (s *BoltDB) Exist(entry feed.Entry) (bool, error)

Exist checks if entry exists

func (*BoltDB) Last

func (s *BoltDB) Last() (feed.Entry, error)

Last returns last (newest) entry across all channels

func (*BoltDB) ListProcessed

func (s *BoltDB) ListProcessed() (res []string, err error)

ListProcessed returns processed entries stored in processedBkt

func (*BoltDB) Load

func (s *BoltDB) Load(channelID string, max int) ([]feed.Entry, error)

Load entries from bolt for a given channel, up to max in reverse order (from newest to oldest)

func (*BoltDB) Remove

func (s *BoltDB) Remove(entry feed.Entry) error

Remove entry matched by vidoID and channelID

func (*BoltDB) RemoveOld

func (s *BoltDB) RemoveOld(channelID string, keep int) ([]string, error)

RemoveOld removes old entries from bolt and returns the list of removed entry.File the caller should delete the files important: this method returns the list of removed keys even if there was an error

func (*BoltDB) ResetProcessed

func (s *BoltDB) ResetProcessed(entry feed.Entry) error

ResetProcessed resets processed status for a given channel+video

func (*BoltDB) Save

func (s *BoltDB) Save(entry feed.Entry) (bool, error)

Save to bolt, skip if found

func (*BoltDB) SetProcessed

func (s *BoltDB) SetProcessed(entry feed.Entry) error

SetProcessed sets processed status with ts for a given channel+video

Jump to

Keyboard shortcuts

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