Borrowing some ideas from the HDFS Go library