From 367fcde1d983c45a3f70ee9df95140cdad5d1249 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Tue, 15 Jul 2014 23:49:28 +0100 Subject: [PATCH] specify chan direction on partition Scan() --- api/model.go | 6 +----- partition/service.go | 2 +- services/index/service.go | 2 +- services/storage/service.go | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/api/model.go b/api/model.go index 3606a68..54573b8 100644 --- a/api/model.go +++ b/api/model.go @@ -190,11 +190,7 @@ func (u *User) NewAuthKey() *AuthKey { Secret: hex.EncodeToString(b), User: u.Email, } - if u.AuthKeyIds == nil { - u.AuthKeyIds = []string{key.KeyId} - } else { - u.AuthKeyIds = append(u.AuthKeyIds, key.KeyId) - } + u.AuthKeyIds = append(u.AuthKeyIds, key.KeyId) return key } diff --git a/partition/service.go b/partition/service.go index d374a60..ce727b5 100644 --- a/partition/service.go +++ b/partition/service.go @@ -46,7 +46,7 @@ type PartitionedService interface { GetPartitionCounters() map[string]int SetPartitionCounters(map[string]int) GetSelfTarget() string - Scan() chan string + Scan() <-chan string Move(key string) error } diff --git a/services/index/service.go b/services/index/service.go index 3057ba0..ff7b026 100644 --- a/services/index/service.go +++ b/services/index/service.go @@ -72,7 +72,7 @@ func (is *IndexService) Stop() { is.quit <- true } -func (is *IndexService) Scan() chan string { +func (is *IndexService) Scan() <-chan string { ch := make(chan string) idCh := make(chan api.SongID) diff --git a/services/storage/service.go b/services/storage/service.go index 20747fc..c8ddc55 100644 --- a/services/storage/service.go +++ b/services/storage/service.go @@ -58,7 +58,7 @@ func NewStorageService(fsRoot string, authKey *api.AuthKey, pmap *partition.Part } } -func (ss *StorageService) Scan() chan string { +func (ss *StorageService) Scan() <-chan string { ch := make(chan string) go func() { -- GitLab