Browse code

mtree: docs for pv_dstid, pv_weight and pv_count

- GH #2750

Daniel-Constantin Mierla authored on 29/05/2021 13:24:40
Showing 1 changed files
... ...
@@ -139,10 +139,19 @@ modparam("mtree", "db_table", "mtrees")
139 139
 		</listitem>
140 140
 		<listitem>
141 141
 			<para>
142
-				type - the  type of tree elements (0 = string, 2 = integer).
143
-				It is valid only when the (tprefix, tvalue) pairs are loaded
142
+				type - the  type of tree elements (0 = string, 1 = d:w, 2 = integer).
143
+				None-zero is valid only when the (tprefix, tvalue) pairs are loaded
144 144
 				(not for multi-column values).
145 145
 			</para>
146
+			<para>
147
+				When the type is 1, the value in database has to be two integers
148
+				separated by colon, the first one (d - dstid) will be stored in
149
+				pv_dstid AVP and the second (w - weight) will be stored in
150
+				pv_weight AVP. If in the matching records are many with the same
151
+				dstid, it will keep only the one with the longest prefix. Then
152
+				the records are ordered by the weight and stored in the specified
153
+				AVPs. The number of stored records is saved in pv_count variable.
154
+			</para>
146 155
 		</listitem>
147 156
 		<listitem>
148 157
 			<para>
... ...
@@ -318,6 +327,67 @@ modparam("mtree", "pv_values", "$avp(mtvals)")
318 327
 	    </example>
319 328
 	</section>
320 329
 
330
+	<section>
331
+	    <title><varname>pv_dstid</varname> (string)</title>
332
+	    <para>
333
+		The AVP name where to store the first integer value when tree type is 1.
334
+		</para>
335
+	    <para>
336
+		<emphasis>
337
+		    Default value is <quote>$avp(tdstid)</quote>.
338
+		</emphasis>
339
+	    </para>
340
+	    <example>
341
+		<title>Set <varname>pv_dstid</varname> parameter</title>
342
+		<programlisting format="linespecific">
343
+...
344
+modparam("mtree", "pv_dstid", "$var(dstid)")
345
+...
346
+</programlisting>
347
+	    </example>
348
+	</section>
349
+
350
+	<section>
351
+	    <title><varname>pv_weight</varname> (string)</title>
352
+	    <para>
353
+		The AVP name where to store the second integer value when tree type is 1.
354
+		</para>
355
+	    <para>
356
+		<emphasis>
357
+		    Default value is <quote>$avp(tweight)</quote>.
358
+		</emphasis>
359
+	    </para>
360
+	    <example>
361
+		<title>Set <varname>pv_weight</varname> parameter</title>
362
+		<programlisting format="linespecific">
363
+...
364
+modparam("mtree", "pv_dstid", "$var(weight)")
365
+...
366
+</programlisting>
367
+	    </example>
368
+	</section>
369
+
370
+	<section>
371
+	    <title><varname>pv_count</varname> (string)</title>
372
+	    <para>
373
+		The PV spec where to store the count of matched values when tree type
374
+		is 1. It can be any writable PV.
375
+		</para>
376
+	    <para>
377
+		<emphasis>
378
+		    Default value is <quote>$avp(tcount)</quote>.
379
+		</emphasis>
380
+	    </para>
381
+	    <example>
382
+		<title>Set <varname>pv_count</varname> parameter</title>
383
+		<programlisting format="linespecific">
384
+...
385
+modparam("mtree", "pv_count", "$var(count)")
386
+...
387
+</programlisting>
388
+	    </example>
389
+	</section>
390
+
321 391
 	<section>
322 392
 	    <title><varname>mt_tree_type</varname> (integer)</title>
323 393
 	    <para>
... ...
@@ -389,8 +459,8 @@ modparam("mtree", "mt_allow_duplicates", 1)
389 459
 	    </title>
390 460
 	    <para>
391 461
 		Match 'pv' value against 'mtree'. If 'mtree' type is 0 or 2 and value
392
-		of 'mode' is NOT 2, sets a value of the longest matching prefix to
393
-		pseudo variable specified by pv_value parameter. If 'mtree' type is 
462
+		of 'mode' is NOT 2, sets associated value of the longest matching prefix
463
+		to pseudo variable specified by pv_value parameter. If 'mtree' type is
394 464
 		0 or 2 and value of 'mode' is 2, sets values of all matching prefixes
395 465
 		to avp specified by pv_values parameter so that a value of longest
396 466
 		matching prefix is in avp index 0.  Parameter 'mode' can be an integer