diff --git a/util/mapreduce/mapreduce.go b/util/mapreduce/mapreduce.go deleted file mode 100644 index 146e8ea7db8e1e0e40120573acc4d0ccfdd05d1a..0000000000000000000000000000000000000000 --- a/util/mapreduce/mapreduce.go +++ /dev/null @@ -1,26 +0,0 @@ -package mapreduce - -func MapReduce(mapper func(interface{}, chan interface{}), - reducer func(chan interface{}, chan interface{}), - input chan interface{}, - pool_size int) interface{} { - reduce_input := make(chan interface{}) - reduce_output := make(chan interface{}) - worker_output := make(chan chan interface{}, pool_size) - go reducer(reduce_input, reduce_output) - go func() { - for worker_chan := range worker_output { - reduce_input <- <-worker_chan - } - close(reduce_input) - }() - go func() { - for item := range input { - my_chan := make(chan interface{}) - go mapper(item, my_chan) - worker_output <- my_chan - } - close(worker_output) - }() - return <-reduce_output -} diff --git a/util/tempfile.go b/util/tempfile.go deleted file mode 100644 index 815858243546574e30b64c1bf4bc9a7dbf8abfed..0000000000000000000000000000000000000000 --- a/util/tempfile.go +++ /dev/null @@ -1,33 +0,0 @@ -package util - -import ( - "crypto/rand" - "encoding/hex" - "fmt" - "os" - "path/filepath" - "time" -) - -var ( - tmpdir = os.TempDir() -) - -func TempName(prefix, suffix string) string { - buf := make([]byte, 4) - rand.Read(buf) - return filepath.Join( - tmpdir, - fmt.Sprintf( - "%s%d.%d.%s%s", - prefix, - os.Getpid(), - time.Now().Unix(), - hex.EncodeToString(buf), - suffix)) - -} - -func TempFile(prefix, suffix string) (*os.File, error) { - return os.Create(TempName(prefix, suffix)) -}