Пример #1
0
func main() {
	file := os.Args[1]

	err := sample.Upload("http://127.0.0.1:8080/upload", file)

	if err != nil {
		log.Fatal("Error:", err)
	}
}
Пример #2
0
func queueRequest(filename string) {
	// Push the file into a channel

	/*
		if err != nil {
			log.Printf("error queueing file " + filename)
			log.Printf("%+v\n", err)
		}
	*/

	if strings.Contains(*host, "8081") == false {
		for i := 0; i < len(slave_array); i++ {
			url := "http://" + slave_array[i] + "/upload"
			log.Printf("replicating to url")
			go func() {
				err := sample.Upload(url, filename)
				if err != nil {
					log.Printf("Error:", err)
					// TODO: handle this better.
				}
			}()
		}
	}
}