writeUpdateColumn: function()

in lib/protocol/plain_buffer_coded_stream.js [468:518]


    writeUpdateColumn: function (updateType, columnName, columnValue, rowCheckSum) {
        var cellCheckSum = 0;
        this.writeTag(TableStore.plainBufferConsts.TAG_CELL);
        var cellCheckSum = this.writeCellName(columnName, cellCheckSum);
        var timestamp = null;
        if (columnValue != null) {
            if (columnValue instanceof Array) {
                if (columnValue[0] != null) {
                    cellCheckSum = this.writeColumnValueWithChecksum(columnValue[0], cellCheckSum);
                }
                if (columnValue[1] != null) {
                    timestamp = columnValue[1];
                }
            } else {
                cellCheckSum = this.writeColumnValueWithChecksum(columnValue, cellCheckSum);
            }
        }
        if (updateType === TableStore.UpdateType.DELETE) {
            this.writeTag(TableStore.plainBufferConsts.TAG_CELL_TYPE);
            this.outputStream.writeRawByte(TableStore.plainBufferConsts.DELETE_ONE_VERSION);
        } else if (updateType == TableStore.UpdateType.DELETE_ALL) {
            this.writeTag(TableStore.plainBufferConsts.TAG_CELL_TYPE);
            this.outputStream.writeRawByte(TableStore.plainBufferConsts.DELETE_ALL_VERSION);
        } else if (updateType == TableStore.UpdateType.INCREMENT) {
            this.writeTag(TableStore.plainBufferConsts.TAG_CELL_TYPE);
            this.outputStream.writeRawByte(TableStore.plainBufferConsts.INCREMENT);
        }
        if (timestamp != null) {
            this.writeTag(TableStore.plainBufferConsts.TAG_CELL_TIMESTAMP);

            var int64 = TableStore.Long.fromNumber(timestamp);
            this.outputStream.writeInt64LE(int64);
        }
        if (timestamp != null) {
            var int64 = TableStore.Long.fromNumber(timestamp);
            cellCheckSum = TableStore.plainBufferCrc8.crcInt64Buf(cellCheckSum, int64.toBuffer());
        }
        if (updateType === TableStore.UpdateType.DELETE) {
            cellCheckSum = TableStore.plainBufferCrc8.crcInt8(cellCheckSum, TableStore.plainBufferConsts.DELETE_ONE_VERSION);
        }
        if (updateType === TableStore.UpdateType.DELETE_ALL) {
            cellCheckSum = TableStore.plainBufferCrc8.crcInt8(cellCheckSum, TableStore.plainBufferConsts.DELETE_ALL_VERSION);
        }
        if (updateType === TableStore.UpdateType.INCREMENT) {
            cellCheckSum = TableStore.plainBufferCrc8.crcInt8(cellCheckSum, TableStore.plainBufferConsts.INCREMENT);
        }
        this.writeTag(TableStore.plainBufferConsts.TAG_CELL_CHECKSUM);
        this.outputStream.writeRawByte(cellCheckSum);
        rowCheckSum = TableStore.plainBufferCrc8.crcInt8(rowCheckSum, cellCheckSum);
        return rowCheckSum;
    },