Class RecordUsageAnalyser
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.SegmentParser
-
- org.apache.jackrabbit.oak.segment.RecordUsageAnalyser
-
public class RecordUsageAnalyser extends SegmentParser
This utility breaks down space usage per record type. It accounts for value sharing. That is, an instance of this class will remember which records it has seen already and not count those again. Only the effective space taken by the records is taken into account. Slack space from aligning records is not accounted for.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.jackrabbit.oak.segment.SegmentParser
SegmentParser.BlobInfo, SegmentParser.BlobType, SegmentParser.ListBucketInfo, SegmentParser.ListInfo, SegmentParser.MapInfo, SegmentParser.NodeInfo, SegmentParser.PropertyInfo, SegmentParser.TemplateInfo, SegmentParser.ValueInfo
-
-
Constructor Summary
Constructors Constructor Description RecordUsageAnalyser(@NotNull SegmentReader reader)
-
Method Summary
-
Methods inherited from class org.apache.jackrabbit.oak.segment.SegmentParser
onListBucket, onMap, onValue, parseBlob, parseList, parseListBucket, parseMap, parseMapBranch, parseMapDiff, parseMapLeaf, parseNode, parseProperty, parseString, parseTemplate, parseValue
-
-
-
-
Constructor Detail
-
RecordUsageAnalyser
public RecordUsageAnalyser(@NotNull @NotNull SegmentReader reader)
-
-
Method Detail
-
getValueSize
public long getValueSize()
- Returns:
- number of bytes in inlined values (strings and blobs)
-
getTemplateSize
public long getTemplateSize()
- Returns:
- number of bytes in
template
records.
-
getNodeSize
public long getNodeSize()
- Returns:
- number of bytes in
node
records.
-
getMapCount
public long getMapCount()
- Returns:
- number of maps
-
getListCount
public long getListCount()
- Returns:
- number of lists
-
getPropertyCount
public long getPropertyCount()
- Returns:
- number of properties
-
getSmallBlobCount
public long getSmallBlobCount()
- Returns:
- number of
small
blobs.
-
getMediumBlobCount
public long getMediumBlobCount()
- Returns:
- number of
medium
blobs.
-
getLongBlobCount
public long getLongBlobCount()
- Returns:
- number of long blobs.
-
getExternalBlobCount
public long getExternalBlobCount()
- Returns:
- number of external blobs.
-
getSmallStringCount
public long getSmallStringCount()
- Returns:
- number of
small
strings.
-
getMediumStringCount
public long getMediumStringCount()
- Returns:
- number of
medium
strings.
-
getLongStringCount
public long getLongStringCount()
- Returns:
- number of long strings.
-
getTemplateCount
public long getTemplateCount()
- Returns:
- number of templates.
-
getNodeCount
public long getNodeCount()
- Returns:
- number of nodes.
-
analyseNode
public void analyseNode(RecordId nodeId)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
onNode
protected void onNode(RecordId parentId, RecordId nodeId)
Description copied from class:SegmentParser
Callback called bySegmentParser.parseNode(RecordId)
upon encountering a child node.- Overrides:
onNode
in classSegmentParser
- Parameters:
parentId
- id of the parent nodenodeId
- if of the child node
-
onTemplate
protected void onTemplate(RecordId parentId, RecordId templateId)
Description copied from class:SegmentParser
Callback called bySegmentParser.parseNode(RecordId)
upon encountering a template- Overrides:
onTemplate
in classSegmentParser
- Parameters:
parentId
- id of the node being parsedtemplateId
- id of the template
-
onMapDiff
protected void onMapDiff(RecordId parentId, RecordId mapId, MapRecord map)
Description copied from class:SegmentParser
Callback called bySegmentParser.parseMap(RecordId, RecordId, MapRecord)
upon encountering a map diff.- Overrides:
onMapDiff
in classSegmentParser
- Parameters:
parentId
- the id of the parent mapmapId
- the id of the mapmap
- the map
-
onMapLeaf
protected void onMapLeaf(RecordId parentId, RecordId mapId, MapRecord map)
Description copied from class:SegmentParser
Callback called bySegmentParser.parseMap(RecordId, RecordId, MapRecord)
upon encountering a map leaf.- Overrides:
onMapLeaf
in classSegmentParser
- Parameters:
parentId
- the id of the parent mapmapId
- the id of the mapmap
- the map
-
onMapBranch
protected void onMapBranch(RecordId parentId, RecordId mapId, MapRecord map)
Description copied from class:SegmentParser
Callback called bySegmentParser.parseMap(RecordId, RecordId, MapRecord)
upon encountering a map branch.- Overrides:
onMapBranch
in classSegmentParser
- Parameters:
parentId
- the id of the parent mapmapId
- the id of the mapmap
- the map
-
onProperty
protected void onProperty(RecordId parentId, RecordId propertyId, PropertyTemplate template)
Description copied from class:SegmentParser
Callback called bySegmentParser.parseNode(RecordId)
upon encountering a property.- Overrides:
onProperty
in classSegmentParser
- Parameters:
parentId
- the id of the parent nodepropertyId
- the id of the propertytemplate
- the property template
-
onBlob
protected void onBlob(RecordId parentId, RecordId blobId)
Description copied from class:SegmentParser
Callback called bySegmentParser.parseValue(RecordId, RecordId, Type)
upon encountering a blob.- Overrides:
onBlob
in classSegmentParser
- Parameters:
parentId
- the id of the blob's parentblobId
- the id of the blob
-
onString
protected void onString(RecordId parentId, RecordId stringId)
Description copied from class:SegmentParser
Callback called bySegmentParser.parseTemplate(RecordId)
,SegmentParser.parseMapLeaf(RecordId, MapRecord)
andSegmentParser.parseValue(RecordId, RecordId, Type)
upon encountering a string.- Overrides:
onString
in classSegmentParser
- Parameters:
parentId
- the id of the string's parentstringId
- the id of the string
-
onList
protected void onList(RecordId parentId, RecordId listId, int count)
Description copied from class:SegmentParser
Callback called bySegmentParser.parseNode(RecordId)
,SegmentParser.parseProperty(RecordId, RecordId, PropertyTemplate)
,SegmentParser.parseTemplate(RecordId)
,SegmentParser.parseBlob(RecordId)
andSegmentParser.parseString(RecordId)
upon encountering a list.- Overrides:
onList
in classSegmentParser
- Parameters:
parentId
- the id of the list's parentlistId
- the id of the listcount
- the number of elements in the list
-
-