Documentation ¶
Index ¶
- type DirImageCache
- func (dic *DirImageCache) GetCardImage(ctx context.Context, cardID, fileType string) ([]byte, bool, error)
- func (dic *DirImageCache) GetDeckImage(ctx context.Context, deckID, fileType string) ([]byte, bool, error)
- func (dic *DirImageCache) StoreCardImage(ctx context.Context, cardID, fileType string, data []byte) error
- func (dic *DirImageCache) StoreDeckImage(ctx context.Context, deckID, fileType string, data []byte) error
- type SQLiteStorage
- func (s *SQLiteStorage) GetCard(ctx context.Context, id string) (card *forgefs.Card, err error)
- func (s *SQLiteStorage) GetCardImageURL(ctx context.Context, id string) (url string, err error)
- func (s *SQLiteStorage) GetCardTitles(ctx context.Context) (titles map[string]string, err error)
- func (s *SQLiteStorage) GetCardsCount(ctx context.Context) (count int, err error)
- func (s *SQLiteStorage) GetDeck(ctx context.Context, id string) (deck *forgefs.Deck, err error)
- func (s *SQLiteStorage) GetDecksCount(ctx context.Context) (count int, err error)
- func (s *SQLiteStorage) GetMyDeckMetadata(ctx context.Context) (mds map[string]forgefs.DeckMetadata, err error)
- func (s *SQLiteStorage) GetMyDeckMetadataWithFilter(ctx context.Context, filterRoot *filter.Node) (mds map[string]forgefs.DeckMetadata, err error)
- func (s *SQLiteStorage) GetSampleDeckWithVersion(ctx context.Context) (deckID string, sasVersion int, err error)
- func (s *SQLiteStorage) Reset(ctx context.Context) error
- func (s *SQLiteStorage) Shutdown() error
- func (s *SQLiteStorage) StoreCards(ctx context.Context, cards []forgefs.Card) error
- func (s *SQLiteStorage) StoreDecks(ctx context.Context, decks []forgefs.Deck) error
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) GetCardImageURL ¶
GetCardImageURL implements the forgefs.Storage interface.
func (*SQLiteStorage) GetCardTitles ¶
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) 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 ¶
StoreCards implements the forgefs.Storage interface.
func (*SQLiteStorage) StoreDecks ¶
StoreDecks implements the forgefs.Storage interface.