Merge pull request #850 from harshavardhana/pr_out_user_struct_instead_of_bool_for_saving_session_saves_a_1byte

This commit is contained in:
Harshavardhana
2015-07-01 18:34:01 +00:00
3 changed files with 13 additions and 11 deletions
+2 -1
View File
@@ -115,7 +115,8 @@ func doCopySession(cURLs cpURLs, bar *barSend, s *sessionV1) error {
}
// store files which have finished copying
s.Files[cURLs.SourceContent.Name] = true
s.Files[cURLs.SourceContent.Name] = struct{}{}
return nil
}
+2 -1
View File
@@ -130,8 +130,9 @@ func doSyncSession(sURLs syncURLs, bar *barSend, syncQueue chan bool, ssCh chan
}
}
<-syncQueue // Signal that this copy routine is done.
// store files which have finished copying
s.Files[sURLs.SourceContent.Name] = true
s.Files[sURLs.SourceContent.Name] = struct{}{}
}
func doPrepareSyncURLs(sourceURL string, targetURLs []string, bar barSend, lock countlock.Locker) {
+9 -9
View File
@@ -30,13 +30,13 @@ import (
)
type sessionV1 struct {
Version string `json:"version"`
Started time.Time `json:"started"`
CommandType string `json:"command-type"`
SessionID string `json:"session-id"`
RootPath string `json:"working-directory"`
URLs []string `json:"args"`
Files map[string]bool `json:"files"`
Version string `json:"version"`
Started time.Time `json:"started"`
CommandType string `json:"command-type"`
SessionID string `json:"session-id"`
RootPath string `json:"working-directory"`
URLs []string `json:"args"`
Files map[string]struct{} `json:"files"`
Lock *sync.Mutex `json:"-"`
}
@@ -98,7 +98,7 @@ func newSessionV1() (config quick.Config, err error) {
// map of command and files copied
s.URLs = nil
s.Started = time.Now().UTC()
s.Files = make(map[string]bool)
s.Files = make(map[string]struct{})
s.Lock = new(sync.Mutex)
s.SessionID = newSID(8)
return quick.New(s)
@@ -152,7 +152,7 @@ func loadSession(sid string) (*sessionV1, error) {
// map of command and files copied
s.URLs = nil
s.Lock = new(sync.Mutex)
s.Files = make(map[string]bool)
s.Files = make(map[string]struct{})
qs, err := quick.New(s)
if err != nil {
return nil, iodine.New(err, nil)