Record Class YamlLimits
- Record Components:
maxAliasExpansion- maximum expansion factor of any candidate node (reference default: 50)maxExpandedSlots- maximum value slots a document containing an alias or merge key materializes (reference default: 1 000 000)
Both are finite, as D-10 requires, and both are enforced by YamlCodec.readWithLimits(String, YamlLimits) on the composed node graph before anything is materialized (D-19).
maxAliasExpansion is compared against E = W / S of every candidate node: an
input is rejected with document.limit.alias-expansion when some E is greater than
it, and accepted when it is equal. maxExpandedSlots is compared against W of the
document root, only for an input that contains an alias or a merge key: an input is rejected with
document.limit.expanded-size when W(root) is greater than it, and accepted when
it is equal.
Like Limits, a value that is not positive is refused with
IllegalArgumentException rather than quietly replaced by the default. A value above the
ceiling is refused too: maxAliasExpansion at most 10000,
maxExpandedSlots at most 10000000L (the ceiling the spec
recommends for D-22; it measured about 780 bytes per slot in Go, so past it the cap no longer
bounds memory on a typical heap).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final YamlLimitsThe reference defaults.static final intReference default for the maximum alias expansion factor (D-18).static final longReference default for the maximum expanded size in value slots (D-22).static final intLargest acceptedmaxAliasExpansion.static final longLargest acceptedmaxExpandedSlots: the ceiling omnist-spec D-22 recommends. -
Constructor Summary
ConstructorsConstructorDescriptionYamlLimits(int maxAliasExpansion, long maxExpandedSlots) Creates an instance of aYamlLimitsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxAliasExpansionrecord component.longReturns the value of themaxExpandedSlotsrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_MAX_ALIAS_EXPANSION
public static final int DEFAULT_MAX_ALIAS_EXPANSIONReference default for the maximum alias expansion factor (D-18).- See Also:
-
DEFAULT_MAX_EXPANDED_SLOTS
public static final long DEFAULT_MAX_EXPANDED_SLOTSReference default for the maximum expanded size in value slots (D-22).- See Also:
-
MAX_ALIAS_EXPANSION_CEILING
public static final int MAX_ALIAS_EXPANSION_CEILINGLargest acceptedmaxAliasExpansion.- See Also:
-
MAX_EXPANDED_SLOTS_CEILING
public static final long MAX_EXPANDED_SLOTS_CEILINGLargest acceptedmaxExpandedSlots: the ceiling omnist-spec D-22 recommends.- See Also:
-
DEFAULT
The reference defaults.
-
-
Constructor Details
-
YamlLimits
public YamlLimits(int maxAliasExpansion, long maxExpandedSlots) Creates an instance of aYamlLimitsrecord class.- Parameters:
maxAliasExpansion- the value for themaxAliasExpansionrecord componentmaxExpandedSlots- the value for themaxExpandedSlotsrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
maxAliasExpansion
public int maxAliasExpansion()Returns the value of themaxAliasExpansionrecord component.- Returns:
- the value of the
maxAliasExpansionrecord component
-
maxExpandedSlots
public long maxExpandedSlots()Returns the value of themaxExpandedSlotsrecord component.- Returns:
- the value of the
maxExpandedSlotsrecord component
-