29 Commits
Author SHA1 Message Date
swaits 2e97c879e1 bump crate to 0.5.3
Signed-off-by: Stephen Waits <steve@waits.net>
0.5.3
2023-02-09 11:18:04 -07:00
swaits 64543a8729 doc: updates to NetworkCoordinate
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-09 11:17:27 -07:00
swaits 8d1eadb017 enable cargo fmt check in autobuild
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-09 11:02:03 -07:00
swaits cdab359b4e enable and fix stricter clippy linting
- add clippy to .build.yml to run on sr.ht
- add missing docs
- use core:: instead of std:: where possible
- use hypot() and mul_add() for better numeric stability
- make all float tests use asser_approx_eq() and explicitly check for NaN/Inf
- add missing semicolons here and there
- add #[must_use] to ensure caller uses returned value
- add const fn where appropriate
- change visibility from pub(crate) to pub (in private modules)

Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-09 10:54:42 -07:00
swaits c3b3ff1e4d feat: f32/f64 cargo features added
Signed-off-by: Stephen Waits <steve@waits.net>
0.5.2
2023-02-08 17:01:19 -07:00
swaits 2addbc68b5 doc: minor updates re: type aliases, crate to 0.5.1
Signed-off-by: Stephen Waits <steve@waits.net>
0.5.1
2023-02-08 15:59:15 -07:00
swaits 6294d1e520 doc: udpate crate description 2023-02-08 15:48:46 -07:00
swaits 2f8769012b bump crate to 0.5.0
Signed-off-by: Stephen Waits <steve@waits.net>
0.5.0
2023-02-08 15:40:47 -07:00
swaits 57891ed230 feat: type aliases for 2D/3D NetworkCoordinates
This just adds a few type aliases for convenience, and slightly better ergonomics for the most common usage (2D or 3D).

Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-08 15:40:23 -07:00
swaits fce4946369 feat: improve ergonomics for serialization format
Goal: To make the serialization format more sensible instead of it being a reflection of our internal (ie private) data model.

- mostly handled with #[serde()] macros (renaming, flattening)
- renamed NetworkCoordinate::position to heightvec which is a better name, even if not seen in the published interface
- changed HeightVector from a tuple struct to a named struct so we can control serde on a field-by-field basis
- updated README, tests, and doc tests to match

Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-08 15:32:27 -07:00
swaits 7f41676795 fix: exclude examples from crate
crates.io is limited to 10MB crates

Signed-off-by: Stephen Waits <steve@waits.net>
0.4.1
2023-02-07 22:09:28 -07:00
swaits 634064161f bump crate version
Signed-off-by: Stephen Waits <steve@waits.net>
0.4.0
2023-02-07 21:44:47 -07:00
swaits 0d9b623f9d test: add test for NetworkCoordinate::estimate_rtt
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-07 21:43:35 -07:00
swaits 828efdda01 misc: formatting
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-07 21:37:29 -07:00
swaits 3cf2f27569 test: add property tests to HeightVector
Which also helped me fix a bug (using is_sign_negative() when we actually are okay with -0.0).

Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-07 21:37:21 -07:00
swaits 2b8fc16537 feat: add PlanetLab example
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-07 20:40:06 -07:00
swaits 8f1100d64d fix: add numeric stability
Made `HeightVector` numerically safe; while `Vector` remains numerically unsafe (i.e. it can divide by 0, NaN, Inf, etc).

When HeightVector runs into a problem, it just re-randomizes itself. Since the algorithm converges relatively quickly, this seems to work fine.

Also fixed a bug so that now height will always start as a positive number (and stay that way, else get re-randomized).

Added safety to `NetworkCoordinate` which now checks that its error didn’t pull a `HeightVector` into a negative height; in which case it also re-randomizes.

Clarified the `random` construction, tweaked the DEFAULT_ERROR constant, and updated tests accordingly.

Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-07 20:25:10 -07:00
swaits 973365a849 test: add proptest, make vec mul/div scalar safer
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-07 16:29:01 -07:00
swaits e2d14bcc0d doc: add link to ticket tracker
Signed-off-by: Stephen Waits <steve@waits.net>
0.3.1
2023-02-04 10:48:28 -07:00
swaits 25e0076c8d doc: add link to docs.rs in README
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-04 10:43:36 -07:00
swaits aba483c9e1 bump crate version
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-04 10:40:57 -07:00
swaits e9febc6faa clean up export, add module level docs
- public NetworkCoordinate so it’s easer to just `use vivaldi_nc::NetworkCoordinate`
- add module level docs and examples in lib.rs
- cleanup README

Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-04 10:39:59 -07:00
swaits c83a4e654b update README, bump crate version
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-04 09:48:01 -07:00
swaits 2fad2e18b5 feat: add serde
Adds serialization/deserialization support via serde and serde_with.

Also:

- remove `license-file` in Cargo.toml (superfluous)
- update README with Getting Started section
- add `serde` and `serde_with` dependencies to README
- add tests to `HeightVector`
- tweak assertion in `NetworkCoordinate`
- refactor `Vector` to be a struct witn an `inner` instead of a tuple struct so that we can use `serde_as` (from `serde_with`) to help us derive SerDe implementations for the const generic sized array
- moved trait requirements (which are getting long) into where clauses

Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-04 09:42:46 -07:00
swaits 3415347072 remove Cargo.lock and add to .gitignore
Because this is a library, Cargo.lock should not be committed.

Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-04 09:37:40 -07:00
swaits 5611618126 prep Cargo.toml for publication, add badges
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-02 22:33:15 -07:00
swaits c2399c5b8f add build badge to readme
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-02 21:56:18 -07:00
swaits f35680738c Add build script for git.sr.ht
Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-02 21:48:35 -07:00
swaits f29deb5335 initial commit
Includes an initial implementation, some tests, and some documentation.

Signed-off-by: Stephen Waits <steve@waits.net>
2023-02-02 21:19:09 -07:00