Adds a skeleton for an AlbumDescriptionCache
This commit is contained in:
5
album.go
5
album.go
@@ -13,6 +13,9 @@ import (
|
||||
// An AlbumState describe the state of an Album
|
||||
type AlbumState int
|
||||
|
||||
// An AlbumID uniquely identifies an Album both here and www.bedetheque.com
|
||||
type AlbumID uint64
|
||||
|
||||
const (
|
||||
// NEW is "État neuf" state
|
||||
NEW AlbumState = iota // 0
|
||||
@@ -31,7 +34,7 @@ const (
|
||||
// This is basically the data we store on bdgest.com, and that we want
|
||||
// in our system to be retrieve from
|
||||
type Album struct {
|
||||
ID uint64
|
||||
ID AlbumID
|
||||
ISBN string
|
||||
Series string
|
||||
Title string
|
||||
|
||||
@@ -85,7 +85,7 @@ func (r *AlbumCsvReader) Read() (*Album, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("AlbumCsvReader: %s: %s", cID, err)
|
||||
}
|
||||
res.ID = uint64(ID)
|
||||
res.ID = AlbumID(ID)
|
||||
|
||||
if len(data[r.columns[cNum]]) == 0 {
|
||||
res.Num = -1
|
||||
|
||||
17
album_description_cache.go
Normal file
17
album_description_cache.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
// An AlbumDescriptionCache is used to fetch and cache AlbumDescription from www.bedetheque.com
|
||||
type AlbumDescriptionCache struct {
|
||||
}
|
||||
|
||||
// NewAlbumDescriptionCache is creating a new album description at specified location
|
||||
func NewAlbumDescriptionCache(filepath string) (*AlbumDescriptionCache, error) {
|
||||
return nil, fmt.Errorf("Not yet implemented")
|
||||
}
|
||||
|
||||
// GetDescription retrieves from the cache or either from www.bedetheque.com the AlbumDescription of an album
|
||||
func (c *AlbumDescriptionCache) GetDescription(ID AlbumID) (*AlbumDescription, error) {
|
||||
return nil, fmt.Errorf("Not yet implemented")
|
||||
}
|
||||
10
album_description_cache_test.go
Normal file
10
album_description_cache_test.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package main
|
||||
|
||||
import . "gopkg.in/check.v1"
|
||||
|
||||
type AlbumDescriptionCacheSuite struct{}
|
||||
|
||||
var _ = Suite(&AlbumDescriptionCacheSuite{})
|
||||
|
||||
func (s *AlbumDescriptionCacheSuite) TestCanFetchCache(c *C) {
|
||||
}
|
||||
Reference in New Issue
Block a user