Documentation
¶
Overview ¶
conflux - Distributed database synchronization library Based on the algorithm described in "Set Reconciliation with Nearly Optimal Communication Complexity", Yaron Minsky, Ari Trachtenberg, and Richard Zippel, 2004. Copyright (C) 2012 Casey Marshall <casey.marshall@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Variables
- func PolyDivmod(x, y *Poly) (q *Poly, r *Poly, err error)
- func Reconcile(values []*Zp, points []*Zp, degDiff int) (*ZSet, *ZSet, error)
- func ReverseByte(b byte) (r byte)
- func ReverseBytes(buf []byte) (result []byte)
- type Bitstring
- func (bs *Bitstring) BitLen() int
- func (bs *Bitstring) ByteLen() int
- func (bs *Bitstring) Bytes() []byte
- func (bs *Bitstring) Flip(bit int)
- func (bs *Bitstring) Get(bit int) int
- func (bs *Bitstring) Lsh(n uint)
- func (bs *Bitstring) Rsh(n uint)
- func (bs *Bitstring) Set(bit int)
- func (bs *Bitstring) SetBytes(buf []byte)
- func (bs *Bitstring) String() string
- func (bs *Bitstring) Unset(bit int)
- type Matrix
- type Poly
- func (p *Poly) Add(x, y *Poly) *Poly
- func (p *Poly) Coeff() []*Zp
- func (p *Poly) Copy() *Poly
- func (p *Poly) Degree() int
- func (p *Poly) Equal(q *Poly) bool
- func (p *Poly) Eval(z *Zp) *Zp
- func (p *Poly) Factor() (roots *ZSet, err error)
- func (p *Poly) IsConstant(c *Zp) bool
- func (p *Poly) Mul(x, y *Poly) *Poly
- func (p *Poly) Neg() *Poly
- func (p *Poly) P() *big.Int
- func (p *Poly) String() string
- func (p *Poly) Sub(x, y *Poly) *Poly
- type RationalFn
- type ZSet
- type Zp
- func (zp *Zp) Add(x, y *Zp) *Zp
- func (zp *Zp) Cmp(x *Zp) int
- func (zp *Zp) Copy() *Zp
- func (zp *Zp) Div(x, y *Zp) *Zp
- func (zp *Zp) Exp(x, y *Zp) *Zp
- func (zp *Zp) Inv() *Zp
- func (zp *Zp) IsZero() bool
- func (zp *Zp) Mul(x, y *Zp) *Zp
- func (zp *Zp) Neg() *Zp
- func (zp *Zp) Norm() *Zp
- func (zp *Zp) Sub(x, y *Zp) *Zp
- type ZpSlice
Constants ¶
This section is empty.
Variables ¶
var InterpolationFailure = errors.New("Interpolation failed")
var LowMBar error = errors.New("Low MBar")
var MatrixTooNarrow = errors.New("Matrix is too narrow to reduce")
var P_128 = big.NewInt(0).SetBytes([]byte{
0x1, 0x11, 0xd, 0xb2, 0x97, 0xcd, 0x30, 0x8d,
0x90, 0xe5, 0x3f, 0xb8, 0xa1, 0x30, 0x90, 0x97, 0xe9})
P for a finite field Z(P) that includes all 128-bit integers.
var P_160 = big.NewInt(0).SetBytes([]byte{
0x1, 0xfe, 0x90, 0xe7, 0xb4, 0x19, 0x88, 0xa6,
0x41, 0xb1, 0xa6, 0xfe, 0xc8, 0x7d, 0x89, 0xa3,
0x1e, 0x2a, 0x61, 0x31, 0xf5})
P for a finite field Z(P) that includes all 160-bit integers.
var P_256 = big.NewInt(0).SetBytes([]byte{
0x1, 0xdd, 0xf4, 0x8a, 0xc3, 0x45, 0x19, 0x18,
0x13, 0xab, 0x7d, 0x92, 0x27, 0x99, 0xe8, 0x93,
0x96, 0x19, 0x43, 0x8, 0xa4, 0xa5, 0x9, 0xb,
0x36, 0xc9, 0x62, 0xd5, 0xd5, 0xd6, 0xdd, 0x80, 0x27})
P for a finite field Z(P) that includes all 256-bit integers.
var P_512 = big.NewInt(0).SetBytes([]byte{
0x1, 0xc7, 0x19, 0x72, 0x25, 0xf4, 0xa5, 0xd5,
0x8a, 0xc0, 0x2, 0xa4, 0xdc, 0x8d, 0xb1, 0xd9,
0xb0, 0xa1, 0x5b, 0x7a, 0x43, 0x22, 0x5d, 0x5b,
0x51, 0xa8, 0x1c, 0x76, 0x17, 0x44, 0x2a, 0x4a,
0x9c, 0x62, 0xdc, 0x9e, 0x25, 0xd6, 0xe3, 0x12,
0x1a, 0xea, 0xef, 0xac, 0xd9, 0xfd, 0x8d, 0x6c,
0xb7, 0x26, 0x6d, 0x19, 0x15, 0x53, 0xd7, 0xd,
0xb6, 0x68, 0x3b, 0x65, 0x40, 0x89, 0x18, 0x3e, 0xbd})
P for a finite field Z(P) that includes all 512-bit integers.
var P_SKS *big.Int
Finite field P used by SKS, the Synchronizing Key Server.
var SwapRowNotFound = errors.New("Swap row not found")
Functions ¶
func ReverseByte ¶
func ReverseBytes ¶
Types ¶
type Bitstring ¶
type Bitstring struct {
// contains filtered or unexported fields
}
func NewBitstring ¶
type Poly ¶
type Poly struct {
// contains filtered or unexported fields
}
Poly represents a polynomial in a finite field.
func NewPoly ¶
NewPoly creates a polynomial with the given coefficients, in ascending degree order. For example, NewPoly(1,-2,3) represents the polynomial 3x^2 - 2x + 1.
func PolyRand ¶
PolyRand generates a random polynomial of degree n. This is useful for probabilistic polynomial factoring.
func (*Poly) Coeff ¶
Coeff returns the coefficients for each term of the polynomial. Coefficients are represented as integers in a finite field Zp.
func (*Poly) Degree ¶
Degree returns the highest exponent that appears in the polynomial. For example, the degree of (x^2 + 1) is 2, the degree of (x^1) is 1.
func (*Poly) Factor ¶
Factor reduces a polynomial to irreducible linear components. If the polynomial is not reducible to a product of linears, the polynomial is useless for reconciliation, resulting in an error. Returns a ZSet of all the constants in each linear factor.
func (*Poly) IsConstant ¶
func (*Poly) P ¶
P returns the integer P defining the finite field of the polynomial's coefficients.
type RationalFn ¶
func Interpolate ¶
func Interpolate(values []*Zp, points []*Zp, degDiff int) (rfn *RationalFn, err error)
type Zp ¶
type Zp struct { // The integer's value. *big.Int // The prime bound of the finite field Z(p). P *big.Int }
Zp represents a value in the finite field Z(p), an integer in which all arithmetic is (mod p).