Class SchemaNormalization
Collection of static methods for generating the cannonical form of schemas.
Inheritance
Inherited Members
Namespace: Avro
Assembly: Avro.dll
Syntax
public static class SchemaNormalization
Fields
| Improve this Doc View SourceEmpty64
Declaration
public static long Empty64
Field Value
Type | Description |
---|---|
System.Int64 |
Methods
| Improve this Doc View SourceFingerprint(String, Byte[])
Returns a fingerprint of a string of bytes. This string is presumed to contain a canonical form of a schema. The algorithm used to compute the fingerprint is selected by the argument fpName.
If fpName equals the string
"CRC-64-AVRO"
, then the result of Avro.SchemaNormalization.Fingerprint64(System.Byte[]) is
returned in little-endian format.
If fpName equals the string
"MD5"
, then the standard MD5 algorithm is used.
If fpName equals the string
"SHA-256"
, then the standard SHA-256 algorithm is used.
Otherwise, fpName is not recognized and an
ArgumentException
is thrown
Recommended Avro practice dictiates that
"CRC-64-AVRO"
is used for 64-bit fingerprints,
"MD5"
is used for 128-bit fingerprints, and
"SHA-256"
is used for 256-bit fingerprints.
Declaration
public static byte[] Fingerprint(string fpName, byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.String | fpName | Name of the hashing algorithm. |
System.Byte[] | data | Data to be hashed. |
Returns
Type | Description |
---|---|
System.Byte[] | Fingerprint |
ParsingFingerprint(String, Schema)
Returns Fingerprint(String, Byte[]) applied to the parsing canonical form of the supplied schema.
Declaration
public static byte[] ParsingFingerprint(string fpName, Schema s)
Parameters
Type | Name | Description |
---|---|---|
System.String | fpName | Name of the hashing algorithm. |
Schema | s | Schema to be hashed. |
Returns
Type | Description |
---|---|
System.Byte[] | Fingerprint |
ParsingFingerprint64(Schema)
Returns Avro.SchemaNormalization.Fingerprint64(System.Byte[]) applied to the parsing canonical form of the supplied schema.
Declaration
public static long ParsingFingerprint64(Schema s)
Parameters
Type | Name | Description |
---|---|---|
Schema | s | Schema to be hashed. |
Returns
Type | Description |
---|---|
System.Int64 | Fingerprint |
ToParsingForm(Schema)
Parses a schema into the canonical form as defined by Avro spec.
Declaration
public static string ToParsingForm(Schema s)
Parameters
Type | Name | Description |
---|---|---|
Schema | s | Schema |
Returns
Type | Description |
---|---|
System.String | Parsing Canonical Form of a schema as defined by Avro spec. |