computeUpdateRowSize: function()

in lib/protocol/plian_buffer_builder.js [123:157]


    computeUpdateRowSize: function (primaryKey, attributeColumns) {
        var size = TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;
        size += this.computePrimaryKeySize(primaryKey);

        if (attributeColumns.length != 0) {
            size += 1;

            for (var i = 0; i < attributeColumns.length; i++) {
                for (var updateType in attributeColumns[i]) {
                    var columns = attributeColumns[i][updateType];
                    if (!columns instanceof Array) {
                        throw new Error("Unsupported column type:" + typeof (columns));
                    }
                    for (var obj in columns) {
                        if (updateType === TableStore.UpdateType.DELETE_ALL) {
                            size += this.computeUpdateColumnSize(columns[obj], null, updateType);
                        } else if (
                            updateType === TableStore.UpdateType.PUT
                            || updateType === TableStore.UpdateType.DELETE
                            || updateType === TableStore.UpdateType.INCREMENT
                        ) {
                            for (var o in columns[obj]) {
                                size += this.computeUpdateColumnSize(o, columns[obj][o], updateType);
                            }
                        } else {
                            throw new Error('Expect TableStore.UpdateType but it was:' + updateType);
                        }
                    }
                    break;
                }
            }
        }
        size += 2;
        return size;
    },