Documentation ¶
Overview ¶
Package vpkeydx contains utilities to generate and analyze keys used in p2p messaging.
Index ¶
- Constants
- func Dec31(i int32) int32
- func Gen(seed []byte, keyName string) ([]byte, error)
- func GenVec1(seed []byte, keyName string, vec1 int32) ([]byte, error)
- func GenVec2(seed []byte, keyName string, vec2 *vpvec2.I32) ([]byte, error)
- func GenVec3(seed []byte, keyName string, vec3 *vpvec3.I32) ([]byte, error)
- func GenX(seed []byte, keyName string, x int32) ([]byte, error)
- func GenXY(seed []byte, keyName string, x int32, y int32) ([]byte, error)
- func GenXYZ(seed []byte, keyName string, x int32, y int32, z int32) ([]byte, error)
- func GetVec1(keyID []byte) (int32, error)
- func GetVec2(keyID []byte) (*vpvec2.I32, error)
- func GetVec3(keyID []byte) (*vpvec3.I32, error)
- func GetX(keyID []byte) (int32, error)
- func GetXY(keyID []byte) (int32, int32, error)
- func GetXYZ(keyID []byte) (int32, int32, int32, error)
- func Inc31(i int32) int32
- func Mod31(i int32) int32
- func Scale31(i int32, n int32) int32
Constants ¶
const PackageCopyright = "Copyright (C) 2015, 2016 Christian Mauduit <ufoot@ufoot.org>" // PackageCopyright set by version.sh
PackageCopyright contains a short copyright notice.
const PackageEmail = "ufoot@ufoot.org" // PackageEmail set by version.sh
PackageEmail contains a contact email for the package.
const PackageLicense = "GNU GPL v3" // PackageLicense set by version.sh
PackageLicense contains a short license information.
const PackageName = "Vapor Toolkit" // PackageName set by version.sh
PackageName contains a readable name of the package, suitable for display.
const PackageTarname = "vapor" // PackageTarname set by version.sh
PackageTarname contains a short name of the package, suitable for a filename.
const PackageURL = "https://github.com/ufoot/vapor" // PackageURL set by version.sh
PackageURL contains the address of the project homepage.
const VersionMajor = 0 // VersionMajor set by version.sh
VersionMajor is the project major version.
const VersionMinor = 3 // VersionMinor set by version.sh
VersionMinor is the project minor version.
const VersionStamp = "c6a4298" // VersionStamp set by version.sh
VersionStamp is the project stamp, possibly changes for each build.
Variables ¶
This section is empty.
Functions ¶
func Gen ¶
Gen generates a unique ID for a key, given a seed. A typical usage of seed is the vring (virtual ring) name, which can be used to differenciate key locations on various vrings.
func GenVec2 ¶
GenVec2 is a wrapper on GenXY, which takes a vector as an argument instead of individual coords.
func GenVec3 ¶
GenVec3 is a wrapper on GenXYZ, which takes a vector as an argument instead of individual coords.
func GenX ¶
GenX generates a unique ID for a key, given a seed. A typical usage of seed is the vring (virtual ring) name, which can be used to differenciate key locations on various vrings. The x parameter has a special meaning, it is used on a 31-bit scale (from 0 to 0x7fffffff) as a prefix for the key. This is used to explicitely store some keys close to some node/host.
func GenXY ¶
GenXY generates a unique ID for a key, given a seed. A typical usage of seed is the vring (virtual ring) name, which can be used to differenciate key locations on various vrings. The x and y parameter have a special meaning, they are used on a 31-bit scale (from 0 to 0x7fffffff) as a prefix for the key. This is used to explicitely store some keys close to some node/host. Technically they are interlaced so that globally, square-like shapes stick together, and avoid the all row 0 first, then all row 1, etc.
func GenXYZ ¶
GenXYZ generates a unique ID for a key, given a seed. A typical usage of seed is the vring (virtual ring) name, which can be used to differenciate key locations on various vrings. The x, y and z parameter have a special meaning, they are used on a 31-bit scale (from 0 to 0x7fffffff) as a prefix for the key. This is used to explicitely store some keys close to some node/host. Technically they are interlaced so that globally, cube-like shapes stick together, and avoid the all row 0 first, then all row 1, etc.
func GetVec1 ¶
GetVec1 gets the 1st (X) coord value for a given key. Note that it can be used for any key, even possibly those which have not be generated with Gen1d.
func GetVec2 ¶
GetVec2 gets the 1st and 2nd (X, Y) coord value for a given key. Note that it can be used for any key, even possibly those which have not be generated with Gen1d.
func GetVec3 ¶
GetVec3 gets the 1st, 2nd and 3rd (X,Y,Z) coord value for a given key. Note that it can be used for any key, even possibly those which have not be generated with Gen1d.
func GetX ¶
GetX gets the X (1st) coord value for a given key. Note that it can be used for any key, even possibly those which have not be generated with Gen1d.
func GetXY ¶
GetXY gets the X,Y (1st and 2nd) coord value for a given key. Note that it can be used for any key, even possibly those which have not be generated with Gen1d.
func GetXYZ ¶
GetXYZ gets the X,Y,Z (1st, 2nd and 3rd) coord value for a given key. Note that it can be used for any key, even possibly those which have not be generated with Gen1d.
Types ¶
This section is empty.