Skip to content

Commit 4063d2d

Browse files
committed
Initial beta release
1 parent 367b258 commit 4063d2d

40 files changed

+6514
-3586
lines changed

.circleci/config.yml

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,42 @@ version: 2
22
jobs:
33
build:
44
docker:
5-
# TODO test on other versions of Rust
6-
- image: circleci/rust:latest
7-
5+
- image: cimg/rust:1.56.1
6+
resource_class: medium+
87
steps:
98
- checkout
10-
11-
- run:
12-
name: Install clippy
13-
command: rustup component add clippy
149
- run:
15-
name: Install rustfmt
16-
command: rustup component add rustfmt
17-
18-
- run: cargo build
19-
- run: cargo test
10+
name: Check Version
11+
command: |
12+
cargo --version
13+
rustc --version
2014
- run:
21-
name: Check consistent formatting
15+
name: Check Formatting
2216
command: cargo fmt && git diff --exit-code
23-
- run: cargo doc --no-deps
24-
- run: cargo clippy -- -D warnings
25-
17+
- run:
18+
name: Install Crate Dependencies
19+
command: sudo apt-get update && sudo apt install libssl-dev libncurses5-dev libncursesw5-dev
20+
- run:
21+
name: Clippy
22+
command: cargo clippy -- -D warnings
23+
- run:
24+
name: Test
25+
command: cargo test
26+
- run:
27+
name: Gather Coverage
28+
command: ./coverage.sh --html
2629
- store_artifacts:
30+
name: Upload Coverage
31+
path: target/llvm-cov/html
32+
destination: coverage
33+
- run:
34+
name: Generate Docs
35+
command: RUSTDOCFLAGS="-Dwarnings" cargo doc --no-deps
36+
- store_artifacts:
37+
name: Upload Docs
2738
path: target/doc
2839
destination: doc
2940

30-
# TODO publish crate
31-
3241
workflows:
3342
version: 2
3443
build:

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Support request
4+
url: https://support.launchdarkly.com/hc/en-us/requests/new
5+
about: File your support requests with LaunchDarkly's support team

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/target
22
**/*.rs.bk
3-
Cargo.lock
3+
Cargo.lock
4+
.idea

.ldrelease/config.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
3+
repo:
4+
public: rust-server-sdk
5+
private: rust-server-sdk-private
6+
7+
publications:
8+
- url: https://docs.rs/launchdarkly-server-sdk
9+
description: crates.io
10+
11+
jobs:
12+
- template:
13+
name: rust

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# Change log
22

33
All notable changes to the LaunchDarkly Rust server-side SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
4+
5+
## [1.0.0-beta.1] - 2022-01-21
6+
Initial beta release of the LaunchDarkly Server-Side SDK for Rust.

CONTRIBUTING.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,35 @@ The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launch
99
## Submitting pull requests
1010

1111
We encourage pull requests and other contributions from the community. Before submitting pull requests, ensure that all temporary or unintended code is removed. Don't worry about adding reviewers to the pull request; the LaunchDarkly SDK team will add themselves. The SDK team will acknowledge all pull requests within two business days.
12+
13+
## Build instructions
14+
15+
This SDK uses the standard `cargo` build system.
16+
17+
### Building
18+
19+
To build the SDK without running any tests:
20+
21+
```sh
22+
cargo build
23+
```
24+
25+
To check and report errors without compiling object files, run:
26+
27+
```sh
28+
cargo check
29+
```
30+
31+
### Testing
32+
33+
To run all tests (unit, doc, etc), run:
34+
35+
```sh
36+
cargo test
37+
```
38+
39+
If you want to only run the much faster unit tests, run:
40+
41+
```sh
42+
cargo test --lib
43+
```

Cargo.toml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,50 @@
11
[package]
2-
name = "ldclient"
3-
version = "0.1.0"
4-
authors = ["Sam Stokes <sstokes@launchdarkly.com>"]
2+
name = "launchdarkly-server-sdk"
3+
description = "LaunchDarkly Server-Side SDK"
4+
version = "1.0.0-beta.1"
5+
authors = ["LaunchDarkly"]
56
edition = "2018"
7+
license = "Apache-2.0"
8+
homepage = "https://docs.launchdarkly.com/sdk/server-side/rust"
9+
repository = "https://github.com/launchdarkly/rust-server-sdk-evaluation"
10+
keywords = ["launchdarkly", "launchdarkly-sdk", "feature-flags", "feature-toggles"]
11+
exclude = [
12+
".circleci",
13+
".github",
14+
".ldrelease",
15+
".pre-commit-config.yaml",
16+
"coverage.sh"
17+
]
618

719
[dependencies]
8-
chrono = "0.4.9"
9-
eventsource-client = "0.3.1"
10-
futures = "0.1.25"
11-
http = ">= 0.1.18"
20+
chrono = "0.4.19"
21+
crossbeam-channel = "0.5.1"
22+
data-encoding = "2.3.2"
23+
eventsource-client = "0.8.1"
24+
futures = "0.3.12"
1225
lazy_static = "1.4.0"
13-
log = "0.4.6"
26+
log = "0.4.14"
1427
lru = { version = "0.5.3", default_features = false }
15-
regex = "1"
1628
reqwest = "0.9.11"
17-
semver = "0.10.0"
18-
serde = { version = "1.0.89", features = ["derive"] }
19-
serde_json = "1.0.39"
20-
sha1 = { version = "0.6.0", features = ["std"] }
29+
ring = "0.16.20"
30+
launchdarkly-server-sdk-evaluation = { version = "1.0.0-beta.2" }
31+
serde = { version = "1.0.132", features = ["derive"] }
32+
serde_json = { version = "1.0.73", features = ["float_roundtrip"] }
2133
thiserror = "1.0"
22-
tokio = "0.1.16"
34+
tokio = { version = "1.2.0", features = ["rt-multi-thread"] }
35+
threadpool = "1.8.1"
36+
parking_lot = "0.11.2"
37+
tokio-stream = { version = "0.1.8", features = ["sync"] }
2338

2439
[dev-dependencies]
2540
maplit = "1.0.1"
2641
env_logger = "0.7.1"
42+
serde_json = { version = "1.0.73", features = ["preserve_order"] } # for deterministic JSON testing
2743
spectral = "0.6.0"
2844
cursive = "0.11"
29-
tokio-executor = "0.1.6"
45+
tokio = { version = "1.2.0", features = ["macros", "time"] }
46+
test-case = "1.2.0"
47+
mockito = "0.30.0"
3048

3149
[build-dependencies]
3250
built = "0.4"

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,27 @@
44

55
The LaunchDarkly Server-Side SDK for Rust is designed primarily for use in multi-user systems such as web servers and applications. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications.
66

7+
*This version of the SDK is a **beta** version and should not be considered ready for production use while this message is visible.*
8+
79
## LaunchDarkly overview
810

911
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/docs/getting-started) using LaunchDarkly today!
1012

1113
[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly)
1214

15+
## Getting started
16+
17+
Refer to the [SDK documentation](https://docs.launchdarkly.com/sdk/server-side/rust#getting-started) for instructions on getting started with using the SDK.
18+
19+
This repository also contains several small [example implementations](./examples). You can run these with:
20+
21+
```sh
22+
cargo run --example EXAMPLE_NAME
23+
```
24+
1325
## Learn more
1426

15-
Check out our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](https://docs.launchdarkly.com/docs/rust-server-sdk-reference).
27+
Check out our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](https://docs.launchdarkly.com/sdk/server-side/rust).
1628

1729
## Testing
1830

@@ -34,5 +46,4 @@ We encourage pull requests and other contributions from the community. Check out
3446
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
3547
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
3648
* [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
37-
* [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
38-
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies
49+
* [launchdarkly.com/blog](https://launchdarkly.com/blog/ "LaunchDarkly Blog Documentation") for the latest product updates

coverage.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
set -o pipefail
5+
6+
# We are using an older version of the toolchain for now as there is a bug with
7+
# coverage generation. See https://github.com/rust-lang/rust/issues/79645
8+
export RUSTUP_TOOLCHAIN=nightly-2022-01-09
9+
10+
# cargo-llvm-cov requires the nightly compiler to be installed
11+
rustup toolchain install $RUSTUP_TOOLCHAIN
12+
rustup component add llvm-tools-preview --toolchain $RUSTUP_TOOLCHAIN
13+
cargo install cargo-llvm-cov
14+
15+
# generate coverage report to command line by default; otherwise allow
16+
# CI to pass in '--html' (or other formats).
17+
18+
if [ -n "$1" ]; then
19+
cargo llvm-cov --all-features --workspace "$1"
20+
else
21+
cargo llvm-cov --all-features --workspace
22+
fi

examples/hack.rs

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)