9397: Remove conflicting code for easier merge
authorPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 9 Feb 2017 19:11:35 +0000 (14:11 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 9 Feb 2017 19:11:35 +0000 (14:11 -0500)
sdk/go/manifest/manifest.go
sdk/go/manifest/manifest_test.go

index a9745ae7cd7fb650909516f5e36451214654d792..ff104aacd7ad7872850d5284cf91e5179951b309 100644 (file)
@@ -230,103 +230,6 @@ func parseManifestStream(s string) (m ManifestStream) {
        return
 }
 
-func (m *Manifest) NormalizeManifest() map[string]ManifestStream {
-       streams := make(map[string]ManifestStream)
-
-       for stream := range m.StreamIter() {
-               ms := streams[stream.StreamName]
-
-               if ms.StreamName == "" { // new stream
-                       streams[stream.StreamName] = stream
-               } else {
-                       ms.Blocks = append(ms.Blocks, stream.Blocks...)
-                       ms.FileStreamSegments = append(ms.FileStreamSegments, stream.FileStreamSegments...)
-               }
-       }
-
-       return streams
-}
-
-func (m *Manifest) NormalizedManifestForPath(path string) string {
-       normalized := m.NormalizeManifest()
-
-       var streams []string
-       for _, stream := range normalized {
-               streams = append(streams, stream.StreamName)
-       }
-       sort.Strings(streams)
-
-       path = strings.Trim(path, "/")
-       var subdir, filename string
-
-       if path != "" {
-               if strings.Index(path, "/") == -1 {
-                       isStream := false
-                       for _, v := range streams {
-                               if v == "./"+path {
-                                       isStream = true
-                               }
-                       }
-                       if isStream {
-                               subdir = path
-                       } else {
-                               filename = path
-                       }
-               } else {
-                       pathIdx := strings.LastIndex(path, "/")
-                       if pathIdx >= 0 {
-                               subdir = path[0:pathIdx]
-                               filename = path[pathIdx+1:]
-                       }
-               }
-       }
-
-       manifestForPath := ""
-
-       for _, streamName := range streams {
-               stream := normalized[streamName]
-
-               if subdir != "" && stream.StreamName != "./"+subdir {
-                       continue
-               }
-
-               manifestForPath += stream.StreamName + " " + strings.Join(stream.Blocks, " ") + " "
-
-               currentName := ""
-               currentSpan := []uint64{0, 0}
-               for _, fss := range stream.FileStreamSegments {
-                       if filename != "" && fss.Name != filename {
-                               continue
-                       }
-
-                       if fss.Name != currentName && currentName != "" {
-                               manifestForPath += fmt.Sprintf("%v", currentSpan[0]) + ":" + fmt.Sprintf("%v", currentSpan[1]) + ":" + currentName + " "
-                       }
-
-                       if fss.Name != currentName {
-                               currentName = fss.Name
-                               currentSpan = []uint64{0, 0}
-                       }
-
-                       if currentSpan[1] == 0 {
-                               currentSpan = []uint64{fss.SegPos, fss.SegLen}
-                       } else {
-                               if currentSpan[1] == fss.SegPos {
-                                       currentSpan[1] += fss.SegLen
-                               } else if currentSpan[0]+currentSpan[1] == fss.SegPos {
-                                       currentSpan[1] = fss.SegPos + fss.SegLen
-                               } else {
-                                       manifestForPath += fmt.Sprintf("%v", currentSpan[0]) + ":" + fmt.Sprintf("%v", currentSpan[1]+fss.SegLen) + ":" + fss.Name + " "
-                                       currentSpan = []uint64{fss.SegPos, fss.SegPos + fss.SegLen}
-                               }
-                       }
-               }
-               manifestForPath += fmt.Sprintf("%v", currentSpan[0]) + ":" + fmt.Sprintf("%v", currentSpan[1]) + ":" + currentName + "\n"
-       }
-
-       return manifestForPath
-}
-
 func (m *Manifest) StreamIter() <-chan ManifestStream {
        ch := make(chan ManifestStream)
        go func(input string) {
index 0d58a9ec1116de52529b4b80ffaf1787d2ac71db..2fe427224ec848ea448a172aaf9e991289b46dd3 100644 (file)
@@ -251,9 +251,3 @@ func TestBlockIterWithBadManifest(t *testing.T) {
                }
        }
 }
-
-func TestNormalizeManifest(t *testing.T) {
-       m := Manifest{Text: ". acbd18db4cc2f85cedef654fccc4a4d8+40 0:10:one 10:10:one 20:10:two 30:10:two\n"}
-       normalized := m.NormalizedManifestForPath("")
-       expectEqual(t, normalized, ". acbd18db4cc2f85cedef654fccc4a4d8+40 0:20:one 20:40:two\n")
-}