storage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirImageCache

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

DirImageCache stores image files for cards and decks into a single on-disk directory, with each file named after the UUID of the card/deck.

func NewDirImageCache

func NewDirImageCache(cacheDir string) (*DirImageCache, error)

NewDirImageCache creates a new instance of DirImageCache.

func (*DirImageCache) GetCardImage

func (dic *DirImageCache) GetCardImage(
	ctx context.Context, cardID, fileType string) ([]byte, bool, error)

GetCardImage implements the forgefs.ImageCache interface.

func (*DirImageCache) GetDeckImage

func (dic *DirImageCache) GetDeckImage(
	ctx context.Context, deckID, fileType string) ([]byte, bool, error)

GetDeckImage implements the forgefs.ImageCache interface.

func (*DirImageCache) StoreCardImage

func (dic *DirImageCache) StoreCardImage(
	ctx context.Context, cardID, fileType string, data []byte) error

StoreCardImage implements the forgefs.ImageCache interface.

func (*DirImageCache) StoreDeckImage

func (dic *DirImageCache) StoreDeckImage(
	ctx context.Context, deckID, fileType string, data []byte) error

StoreDeckImage implements the forgefs.ImageCache interface.

type SQLiteStorage

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

SQLiteStorage stores deck and card info in an on-disk SQLite file.

func NewSQLiteStorage

func NewSQLiteStorage(
	ctx context.Context, file string) (*SQLiteStorage, error)

NewSQLiteStorage creates a new SQLiteStorage instance.

func (*SQLiteStorage) GetCard

func (s *SQLiteStorage) GetCard(ctx context.Context, id string) (
	card *forgefs.Card, err error)

GetCard implements the forgefs.Storage interface.

func (*SQLiteStorage) GetCardImageURL

func (s *SQLiteStorage) GetCardImageURL(ctx context.Context, id string) (
	url string, err error)

GetCardImageURL implements the forgefs.Storage interface.

func (*SQLiteStorage) GetCardTitles

func (s *SQLiteStorage) GetCardTitles(ctx context.Context) (
	titles map[string]string, err error)

GetCardTitles implements the forgefs.Storage interface.

func (*SQLiteStorage) GetCardsCount

func (s *SQLiteStorage) GetCardsCount(ctx context.Context) (
	count int, err error)

GetCardsCount returns the number of stored cards.

func (*SQLiteStorage) GetDeck

func (s *SQLiteStorage) GetDeck(ctx context.Context, id string) (
	deck *forgefs.Deck, err error)

GetDeck implements the forgefs.Storage interface.

func (*SQLiteStorage) GetDecksCount

func (s *SQLiteStorage) GetDecksCount(ctx context.Context) (
	count int, err error)

GetDecksCount returns the number of stored decks.

func (*SQLiteStorage) GetMyDeckMetadata

func (s *SQLiteStorage) GetMyDeckMetadata(ctx context.Context) (
	mds map[string]forgefs.DeckMetadata, err error)

GetMyDeckMetadata implements the forgefs.Storage interface.

func (*SQLiteStorage) GetMyDeckMetadataWithFilter

func (s *SQLiteStorage) GetMyDeckMetadataWithFilter(
	ctx context.Context, filterRoot *filter.Node) (
	mds map[string]forgefs.DeckMetadata, err error)

GetMyDeckMetadataWithFilter implements the forgefs.Storage interface.

func (*SQLiteStorage) GetSampleDeckWithVersion

func (s *SQLiteStorage) GetSampleDeckWithVersion(ctx context.Context) (
	deckID string, sasVersion int, err error)

GetSampleDeckWithVersion returns a sample deck and its SAS version.

func (*SQLiteStorage) Reset

func (s *SQLiteStorage) Reset(ctx context.Context) error

Reset implements the forgefs.Storage interface.

func (*SQLiteStorage) Shutdown

func (s *SQLiteStorage) Shutdown() error

Shutdown shuts down the storage instance.

func (*SQLiteStorage) StoreCards

func (s *SQLiteStorage) StoreCards(
	ctx context.Context, cards []forgefs.Card) error

StoreCards implements the forgefs.Storage interface.

func (*SQLiteStorage) StoreDecks

func (s *SQLiteStorage) StoreDecks(
	ctx context.Context, decks []forgefs.Deck) error

StoreDecks implements the forgefs.Storage interface.

Jump to

Keyboard shortcuts

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