Ejemplo n.º 1
0
    def new(cls, io, fileheader=FileHeader(), INDEX_COUNT=50, BUFFER_SIZE=10000, OUTPOINTS_SIZE=1000):
        fileheader = io.write(data=FileHeaderSerializer.serialize(fileheader))

        txchunk_file = TransactionalChunkFile.new(io, INDEX_COUNT=INDEX_COUNT, BUFFER_SIZE=BUFFER_SIZE)
        chunkfile = txchunk_file.chunkfile
        # Appending/format other chunks (Not done transactionally)
        chunkfile.append_chunk( OUTPOINTS_NAME, OUTPOINTS_SIZE )
        outpointsio = ChunkIO.from_name(chunkfile, OUTPOINTS_NAME)
        outpoint_dict = SerializedDict.new(outpointsio, outpointsio.size, serializer=OutpointIndexSerializer)
        # re-open them transactionally
        outpoint_io = TransactionalIO.from_chunkname(txchunk_file, OUTPOINTS_NAME)
        outpoint_dict = SerializedDict.load(outpoint_io, OUTPOINTS_SIZE, OutpointIndexSerializer)
        return cls(fileheader, txchunk_file, outpoint_dict)
Ejemplo n.º 2
0
    def new(cls,
            io,
            fileheader=FileHeader(),
            INDEX_COUNT=50,
            BUFFER_SIZE=10000,
            OUTPOINTS_SIZE=1000):
        fileheader = io.write(data=FileHeaderSerializer.serialize(fileheader))

        txchunk_file = TransactionalChunkFile.new(io,
                                                  INDEX_COUNT=INDEX_COUNT,
                                                  BUFFER_SIZE=BUFFER_SIZE)
        chunkfile = txchunk_file.chunkfile
        # Appending/format other chunks (Not done transactionally)
        chunkfile.append_chunk(OUTPOINTS_NAME, OUTPOINTS_SIZE)
        outpointsio = ChunkIO.from_name(chunkfile, OUTPOINTS_NAME)
        outpoint_dict = SerializedDict.new(outpointsio,
                                           outpointsio.size,
                                           serializer=OutpointIndexSerializer)
        # re-open them transactionally
        outpoint_io = TransactionalIO.from_chunkname(txchunk_file,
                                                     OUTPOINTS_NAME)
        outpoint_dict = SerializedDict.load(outpoint_io, OUTPOINTS_SIZE,
                                            OutpointIndexSerializer)
        return cls(fileheader, txchunk_file, outpoint_dict)