24.47. slapi_entry_size()

This function returns the approximate size of an entry, rounded to the nearest 1k. This can be useful for checking cache sizes, estimating storage needs, and so on.
Description

When determining the size of an entry, only the sizes of the attribute values are counted; the size of other entry values (such as the size of attribute names, variously-normalized DNs, or any metadata) are not included in the size returned. It is assumed that the size of the metadata, et al., is well enough accounted for by the rounding of the size to the next largest 1k . This holds true especially in larger entries, where the actual size of the attribute values far outweighs the size of the metadata.

Syntax

#include "slapi-plugin.h"
size_t slapi_entry_size(Slapi_Entry *e);

Parameters

This function takes the following parameter:

e
Entry from which you want the size returned.
Returns

This function returns one of the following values:

  • The size of the entry, rounded to the nearest 1k. The value returned is a size_t data type with a u_long value.
  • A size of 1k if the entry is empty.
When determining the size of the entry, both deleted values and deleted attributes are included in the count.