Packeter

From Adam Colton
Jump to navigation Jump to search

https://github.com/AdamColton/packeter

Packeter

The packeter is meant to be used in Beeds. It breaks messages into packets up to length 10k. For now, I will use Reed Solomon, later I may go back to Raptor codes.

https://github.com/klauspost/reedsolomon

Look at longhair and Jerasure for examples of erasure codes. Look at Raptor codes.

See if this works and if so, port it to Go.

Maths

We need a cumulative binomial distribution for this; that is the probability that if we send X packets, at least Y will be received. For instance, if we send 1000 packets, there's about a 53% change that we'll get at least 950 of them, and about a 99% chance we'll get at least 933 of them. I found that empirically.

http://stackoverflow.com/questions/1095650/how-can-i-efficiently-calculate-the-binomial-cumulative-distribution-function

https://gowalker.org/github.com/ematvey/gostat#Binomial_CDF_At

Actually, I want the inverse cumulative binomial distribution, or quantile function. I've put this on hold for now, the math is taking too long to understand. Instead, I'm iterating over the B_CDF funciton to find the right value.

To Do

UDPServer and Packeter are supposed to work together, but the interfaces don't actually line up, and they wouldn't work the way you'd want any way. I want a downstream service to receive messages transparently. Probably need another layer of wrappers around this. Also need to take concurrency into account to prevent race conditions.