This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
recv_fds reads file descriptors from a unix domain socket. This might be useful | |
if you were, say, wanting to implement short-circuit reads in an HDFS client. | |
The code is broadly based on DomainSocketImpl::receiveFileDescriptors in libhdfs3 | |
and Java_org_apache_hadoop_net_unix_DomainSocket_receiveFileDescriptors0 | |
in libhadoop. | |
The tricky thing here is that we need to call recvmsg, which isn't exposed in | |
the socket module for python 2.7. However, we can access it via ctypes. I've | |
tried the code here out on my machine (x86_64, Ubuntu 14.14, Python 2.7.6) and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (I've ommitted the code supplied as part of the exercise) | |
type crawl_result struct { | |
url string | |
depth int | |
body string | |
urls []string | |
err error | |
} |