]> git.lizzy.rs Git - go-anidb.git/commitdiff
anidb: Document which backend API is used on the Get* methods
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Mon, 15 Jul 2013 04:21:38 +0000 (01:21 -0300)
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Mon, 15 Jul 2013 04:22:53 +0000 (01:22 -0300)
Queries that depend on the UDP API can't be used without SetCredentials.

animecache.go
episodecache.go
filecache.go
groupcache.go

index 91a8c41022fe8c9611acc92c13e1f0f6ede86525..744553a56c24389b57598e568cbe54569e9ee784 100644 (file)
@@ -53,7 +53,7 @@ type httpAnimeResponse struct {
        err   error
 }
 
-// Retrieves an Anime by its AID. Uses both HTTP and UDP APIs,
+// Retrieves an Anime by its AID. Uses both the HTTP and UDP APIs,
 // but can work without the UDP API.
 func (adb *AniDB) AnimeByID(aid AID) <-chan *Anime {
        keys := []cacheKey{"aid", aid}
index 00b2a405ec22243287504dd4a1bfa195bb79384d..4d8fa7e87aca36ea2a3ec6c37f9525cc46fcfe90 100644 (file)
@@ -40,6 +40,10 @@ func cacheEpisode(ep *Episode) {
 }
 
 // Retrieves an Episode by its EID.
+//
+// If we know which AID owns this EID, then it's equivalent
+// to an Anime query. Otherwise, uses both the HTTP and UDP
+// APIs to retrieve it.
 func (adb *AniDB) EpisodeByID(eid EID) <-chan *Episode {
        keys := []cacheKey{"eid", eid}
        ch := make(chan *Episode, 1)
index 631b13998b8b4901a8ee3b79f24ab29d7af3abd2..7813e54c327f10b333508fbae0cac142d20abe23 100644 (file)
@@ -80,7 +80,7 @@ func (f *File) Prefetch(adb *AniDB) <-chan *File {
        return ch
 }
 
-// Retrieves a File by its FID.
+// Retrieves a File by its FID. Uses the UDP API.
 func (adb *AniDB) FileByID(fid FID) <-chan *File {
        keys := []cacheKey{"fid", fid}
 
@@ -125,7 +125,7 @@ func (adb *AniDB) FileByID(fid FID) <-chan *File {
        return ch
 }
 
-// Retrieves a File by its Ed2kHash + Filesize combination.
+// Retrieves a File by its Ed2kHash + Filesize combination. Uses the UDP API.
 func (adb *AniDB) FileByEd2kSize(ed2k string, size int64) <-chan *File {
        keys := []cacheKey{"fid", "by-ed2k", ed2k, size}
 
index 4e659d7a2de74e84d6e5c57f3185d1641be6e834..deed5387679396895b18d2585d4990353f3e139c 100644 (file)
@@ -56,7 +56,7 @@ func (c *gidCache) IsStale() bool {
        return true
 }
 
-// Retrieves a Group by its GID.
+// Retrieves a Group by its GID. Uses the UDP API.
 func (adb *AniDB) GroupByID(gid GID) <-chan *Group {
        keys := []cacheKey{"gid", gid}
        ch := make(chan *Group, 1)
@@ -99,6 +99,7 @@ func (adb *AniDB) GroupByID(gid GID) <-chan *Group {
 }
 
 // Retrieves a Group by its name. Either full or short names are matched.
+// Uses the UDP API.
 func (adb *AniDB) GroupByName(gname string) <-chan *Group {
        keys := []cacheKey{"gid", "by-name", gname}
        altKeys := []cacheKey{"gid", "by-shortname", gname}