Ejemplo n.º 1
0
    def __init__(self, fd, vat):
        self._fd = fd
        self._vat = vat

        self._queue = []

        # XXX read size should be tunable
        self._buf = ruv.allocBuf(16384)
Ejemplo n.º 2
0
Archivo: files.py Proyecto: dckc/typhon
    def __init__(self, fs, fd, vat):
        self.fs = fs
        self.fd = fd
        self.vat = vat

        # XXX read size should be tunable
        self.buf = ruv.allocBuf(16384)

        # Set this up only once.
        ruv.stashFS(self.fs, (self.vat, self))
Ejemplo n.º 3
0
    def __init__(self, fs, fd, vat):
        self._fs = fs
        self._fd = fd
        self._vat = vat

        self._queue = []

        # XXX read size should be tunable
        self._buf = ruv.allocBuf(16384)

        # Set this up only once.
        ruv.stashFS(fs, (vat, self))
Ejemplo n.º 4
0
Archivo: files.py Proyecto: dckc/typhon
    def __init__(self, vat, fs, fd, resolver):
        self.vat = vat
        self.fs = fs
        self.fd = fd
        self.resolver = resolver

        self.pieces = []

        # XXX read size should be tunable
        self.buf = ruv.allocBuf(16384)

        # Do our initial stashing.
        ruv.stashFS(fs, (vat, self))
Ejemplo n.º 5
0
 def getContents(self):
     p, r = makePromise()
     vat = currentVat.get()
     buf = ruv.allocBuf(16384)
     path = self.asBytes()
     log.log(["fs"], u"makeFileResource: Opening file '%s'" % path.decode("utf-8"))
     with io:
         f = 0
         try:
             f = ruv.magic_fsOpen(vat, path, os.O_RDONLY, 0000)
         except object as err:
             smash(r, StrObject(u"Couldn't open file fount: %s" % err))
         else:
             try:
                 contents = readLoop(f, buf)
             except object as err:
                 ruv.magic_fsClose(vat, f)
                 smash(r, StrObject(u"libuv error: %s" % err))
             else:
                 ruv.magic_fsClose(vat, f)
                 resolve(r, BytesObject(contents))
     return p