ItemSize class

class ddbmock.database.item.ItemSize

Utility class to represent an Item size as bytes or capacity units

ItemSize manipulations

__add__

ItemSize.__add__(value)

Transparently allow addition of ItemSize values. This is useful for all batch requests as Scan, Query, BatchWriteItem and BatchReadItem

Parameters:value – foreign int compatible value to add
Returns:new ItemSize value
Raises:TypeError if value is not int compatible

as_units

ItemSize.as_units()

Get item size in terms of capacity units. This does not include the index overhead. Units can not be bellow 1 ie: a DeleteItem on a non existing item is not free

Returns:number of capacity unit consummed by any operation on this ItemSize

with_indexing_overhead

ItemSize.with_indexing_overhead()

Take the indexing overhead into account. this is especially usefull to compute the table disk size as DynamoDB would but it’s not included in the capacity unit calculation.

Returns:ItemSize + ddbmock.config.INDEX_OVERHEAD