Skip to content

Commit 4636c76

Browse files
stigglorpront
andauthored
docs(vrl): Add xxhash vrl function documentation (#23576)
* docs(vrl): Add xxhash vrl function documentation Relates to vectordotdev/vrl#1472 * Fix Documentation Category * update vrl * Fix ThirdParty Licenses And Cue File Correctness --------- Co-authored-by: Pavlos Rontidis <pavlos.rontidis@gmail.com>
1 parent dcf951e commit 4636c76

File tree

5 files changed

+79
-4
lines changed

5 files changed

+79
-4
lines changed

.github/actions/spelling/expect.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,7 @@ wtimeout
672672
WTS
673673
xact
674674
xlarge
675+
XXH
675676
xxs
676677
YAMLs
677678
YBv

Cargo.lock

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE-3rdparty.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ write16,https://github.com/hsivonen/write16,Apache-2.0 OR MIT,The write16 Author
764764
writeable,https://github.com/unicode-org/icu4x,Unicode-3.0,The ICU4X Project Developers
765765
wyz,https://github.com/myrrlyn/wyz,MIT,myrrlyn <self@myrrlyn.dev>
766766
xmlparser,https://github.com/RazrFalcon/xmlparser,MIT OR Apache-2.0,Yevhenii Reizner <razrfalcon@gmail.com>
767+
xxhash-rust,https://github.com/DoumanAsh/xxhash-rust,BSL-1.0,Douman <douman@gmx.se>
767768
yoke,https://github.com/unicode-org/icu4x,Unicode-3.0,Manish Goregaokar <manishsmail@gmail.com>
768769
yoke-derive,https://github.com/unicode-org/icu4x,Unicode-3.0,Manish Goregaokar <manishsmail@gmail.com>
769770
zerocopy,https://github.com/google/zerocopy,BSD-2-Clause OR Apache-2.0 OR MIT,Joshua Liebow-Feeser <joshlf@google.com>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package metadata
2+
3+
remap: functions: xxhash: {
4+
category: "Checksum"
5+
description: """
6+
Calculates a [xxHash](\(urls.xxhash_rust)) hash of the `value`.
7+
**Note**: Due to limitations in the underlying VRL data types, this function converts the unsigned 64-bit integer hash result to a signed 64-bit integer. Results higher than the signed 64-bit integer maximum value wrap around to negative values. For the XXH3-128 hash algorithm, values are returned as a string.
8+
"""
9+
10+
arguments: [
11+
{
12+
name: "value"
13+
description: "The string to calculate the hash for."
14+
required: true
15+
type: ["string"]
16+
},
17+
{
18+
name: "variant"
19+
description: "The xxHash hashing algorithm to use."
20+
required: false
21+
type: ["string"]
22+
default: "XXH32"
23+
},
24+
]
25+
internal_failure_reasons: []
26+
return: types: ["integer", "string"]
27+
28+
examples: [
29+
{
30+
title: "Calculate a hash using the default (XXH32) algorithm"
31+
source: #"""
32+
xxhash("foo")
33+
"""#
34+
return: 3792637401
35+
},
36+
{
37+
title: "Calculate a hash using the XXH32 algorithm"
38+
source: #"""
39+
xxhash("foo", "XXH32")
40+
"""#
41+
return: 3792637401
42+
},
43+
{
44+
title: "Calculate a hash using the XXH64 algorithm"
45+
source: #"""
46+
xxhash("foo", "XXH64")
47+
"""#
48+
return: -3728699739546630719
49+
},
50+
{
51+
title: "Calculate a hash using the XXH3-64 algorithm"
52+
source: #"""
53+
xxhash("foo", "XXH3-64)
54+
"""#
55+
return: -6093828362558603894
56+
},
57+
{
58+
title: "Calculate a hash using the XXH3-128 algorithm"
59+
source: #"""
60+
xxhash("foo", "XXH3-128)
61+
"""#
62+
return: "161745101148472925293886522910304009610"
63+
},
64+
]
65+
}

website/cue/reference/urls.cue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ urls: {
678678
windows_installer: "\(wikipedia)/wiki/Windows_Installer"
679679
windows_service: "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-service"
680680
woothee: "https://github.com/woothee/woothee"
681+
xxhash_rust: "https://github.com/DoumanAsh/xxhash-rust"
681682
yaml: "https://yaml.org/"
682683
ytt: "https://carvel.dev/ytt/"
683684
yum: "\(wikipedia)/wiki/Yum_(software)"

0 commit comments

Comments
 (0)