Skip to content

Commit b8fbea3

Browse files
authored
Merge pull request #24 from skytable/octave
Implement new protocol
2 parents 181af32 + 332635f commit b8fbea3

22 files changed

+1774
-3860
lines changed

.devcontainer/devcontainer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
3+
{
4+
"name": "skycloud-devspace",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/base:jammy",
7+
"features": {
8+
"ghcr.io/devcontainers/features/rust:1": {}
9+
}
10+
11+
// Features to add to the dev container. More info: https://containers.dev/features.
12+
// "features": {},
13+
14+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15+
// "forwardPorts": [],
16+
17+
// Use 'postCreateCommand' to run commands after the container is created.
18+
// "postCreateCommand": "uname -a",
19+
20+
// Configure tool-specific properties.
21+
// "customizations": {},
22+
23+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
24+
// "remoteUser": "root"
25+
}

.github/workflows/test.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v2
1414
- name: Build
15-
run: |
16-
cargo build --verbose --no-default-features --features sync
17-
cargo build --verbose --no-default-features --features sync,ssl
18-
cargo build --verbose --no-default-features --features sync,sslv
19-
cargo build --verbose --no-default-features --features aio
20-
cargo build --verbose --no-default-features --features aio,aio-ssl
21-
cargo build --verbose --no-default-features --features aio,aio-sslv
22-
cargo build --verbose --no-default-features --features dbg
23-
cargo build --verbose --no-default-features --features const-gen
15+
run: cargo build --verbose
2416
- name: Run tests
2517
run: cargo test --all-features

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ Cargo.lock
33
.vscode
44
.DS_Store
55
examples/target
6-
scripts
6+
scripts
7+
src/bin

CHANGELOG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
All changes in this project will be noted in this file.
44

5-
## Unreleased
5+
## 0.8.0
66

7-
### New features
7+
#### New features
8+
- Completely up to date for Skyhash 2.0
9+
- New query API interface for Skytable Octave (completely breaking!)
10+
- No longer depends on OpenSSL
811

9-
- Support for Skyhash 2.0
12+
#### Breaking changes
13+
The enter query interface as changed and is incompatible with previous driver versions. Please consider reading the Skytable
14+
Octave upgrade guide.
1015

1116
## 0.7.0
1217

Cargo.toml

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,15 @@ license = "Apache-2.0"
99
name = "skytable"
1010
readme = "README.md"
1111
repository = "https://github.com/skytable/client-rust"
12-
version = "0.8.0"
12+
version = "0.8.0-beta.1"
1313

1414
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
15-
16-
[features]
17-
default = ["sync"]
18-
# sync
19-
sync = ["r2d2"]
20-
# sync TLS
21-
ssl = ["openssl"]
22-
sslv = ["openssl/vendored"]
23-
# async
24-
aio = ["bytes", "tokio", "bb8", "async-trait"]
25-
# async TLS
26-
aio-ssl = ["tokio-openssl", "openssl"]
27-
aio-sslv = ["tokio-openssl", "openssl/vendored"]
28-
# utilities
29-
const-gen = []
30-
dbg = []
31-
3215
[dependencies]
33-
bytes = { version = "1.2.1", optional = true }
34-
openssl = { version = "0.10.42", optional = true }
35-
tokio = { version = "1.21.2", features = [
36-
"net",
37-
"io-util",
38-
"io-std",
39-
], optional = true, default-features = false }
40-
tokio-openssl = { version = "0.6.3", optional = true }
41-
r2d2 = { version = "0.8.10", optional = true }
42-
bb8 = { version = "0.8.0", optional = true }
43-
async-trait = { version = "0.1.58", optional = true }
44-
45-
[dev-dependencies]
46-
tokio = { version = "1.21.2", features = [
47-
"test-util",
48-
"macros",
49-
], default-features = false }
50-
51-
[package.metadata.docs.rs]
52-
all-features = true
53-
rustdoc-args = ["--cfg", "docsrs"]
16+
tokio = { version = "1.34.0", features = ["full"] }
17+
native-tls = "0.2.11"
18+
tokio-native-tls = "0.3.1"
19+
rand = "0.8.5"
20+
r2d2 = "0.8.10"
21+
async-trait = "0.1.74"
22+
bb8 = "0.8.1"
23+
itoa = "1.0.9"

README.md

Lines changed: 7 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -35,149 +35,20 @@ cargo new skyapp
3535
First add this to your `Cargo.toml` file:
3636

3737
```toml
38-
skytable = "0.7.0-alpha.4"
38+
skytable = "0.8.0-beta.1"
3939
```
4040

41-
Now open up your `src/main.rs` file and establish a connection to the server while also adding some
42-
imports:
41+
You're ready to go!
4342

4443
```rust
45-
use skytable::{Connection, Query, Element, SkyResult};
46-
fn main() -> SkyResult<()> {
47-
let mut con = Connection::new("127.0.0.1", 2003)?;
48-
Ok(())
49-
}
50-
```
51-
52-
Now let's run a `Query`! Change the previous code block to:
53-
54-
```rust
55-
use skytable::{error, Connection, Query, Element};
56-
fn main() -> Result<(), error::Error> {
57-
let mut con = Connection::new("127.0.0.1", 2003)?;
58-
let query = Query::from("heya");
59-
let res: String = con.run_query(&query)?;
60-
assert_eq!(res, "HEY!");
61-
Ok(())
62-
}
63-
```
64-
65-
## Running actions
66-
67-
As noted [below](#binary-data), the default table is a key/value table with a binary key
68-
type and a binary value type. Let's go ahead and run some actions (we're assuming you're
69-
using the sync API; for async, simply change the import to `use skytable::actions::AsyncActions`).
70-
71-
### `SET`ting a key
72-
73-
```rust
74-
use skytable::actions::Actions;
75-
use skytable::sync::Connection;
76-
77-
let mut con = Connection::new("127.0.0.1", 2003).unwrap();
78-
con.set("hello", "world").unwrap();
79-
```
80-
81-
This will set the value of the key `hello` to `world` in the `default:default` entity.
82-
83-
### `GET`ting a key
84-
85-
```rust
86-
use skytable::actions::Actions;
87-
use skytable::sync::Connection;
88-
89-
let mut con = Connection::new("127.0.0.1", 2003).unwrap();
90-
let x: String = con.get("hello").unwrap();
91-
assert_eq!(x, "world");
92-
```
93-
94-
Way to go &mdash; you're all set! Now go ahead and run more advanced queries!
95-
96-
## Binary data
97-
98-
The `default:default` keyspace has the following declaration:
99-
100-
```text
101-
Keymap { data:(binstr,binstr), volatile:false }
102-
```
103-
104-
This means that the default keyspace is ready to store binary data. Let's say
105-
you wanted to `SET` the value of a key called `bindata` to some binary data stored
106-
in a `Vec<u8>`. You can achieve this with the `RawString` type:
107-
108-
```rust
109-
use skytable::actions::Actions;
110-
use skytable::sync::Connection;
111-
use skytable::types::RawString;
112-
113-
let mut con = Connection::new("127.0.0.1", 2003).unwrap();
114-
let mybinarydata = RawString::from(vec![1, 2, 3, 4]);
115-
assert!(con.set("bindata", mybinarydata).unwrap());
116-
```
44+
use skytable::{Config, query};
11745

118-
## Going advanced
119-
120-
Now that you know how you can run basic queries, check out the [`actions`] module documentation for learning
121-
to use actions and the [`types`] module documentation for implementing your own Skyhash serializable
122-
types. Need to meddle with DDL queries like creating and dropping tables? Check out the [`ddl`] module.
123-
You can also find some [examples here](https://github.com/skytable/client-rust/tree/v0.7.0-alpha.4/examples)
124-
125-
## Connection pooling
126-
127-
This library supports using sync/async connection pools. See the [`pool`] module-level documentation for examples
128-
and information.
129-
130-
## Async API
131-
132-
If you need to use an `async` API, just change your import to:
133-
134-
```toml
135-
skytable = { version = "0.7.0-alpha.4", features=["aio"], default-features = false }
136-
```
137-
138-
You can now establish a connection by using `skytable::AsyncConnection::new()`, adding `.await`s wherever
139-
necessary. Do note that you'll use the [Tokio runtime](https://tokio.rs).
140-
141-
## Using both `sync` and `async` APIs
142-
143-
With this client driver, it is possible to use both sync and `async` APIs **at the same time**. To do
144-
this, simply change your import to:
145-
146-
```toml
147-
skytable = { version="0.7.0-alpha.4", features=["sync", "aio"] }
148-
```
149-
150-
## TLS
151-
152-
If you need to use TLS features, this crate will let you do so with OpenSSL.
153-
154-
### Using TLS with sync interfaces
155-
156-
```toml
157-
skytable = { version="0.7.0-alpha.4", features=["sync","ssl"] }
158-
```
159-
160-
You can now use the async `sync::TlsConnection` object.
161-
162-
### Using TLS with async interfaces
163-
164-
```toml
165-
skytable = { version="0.7.0-alpha.4", features=["aio","aio-ssl"], default-features=false }
46+
let mut db = Config::new_default("username", "password").connect().unwrap();
47+
let query = query!("select username, password from myspace.mytbl WHERE username = ?", your_fn_to_get_user());
48+
let (username, password) = db.query_parse::<(String, String)>(&query).unwrap();
16649
```
16750

168-
You can now use the async `aio::TlsConnection` object.
169-
170-
### _Packed TLS_ setup
171-
172-
If you want to pack OpenSSL with your crate, then for sync add `sslv` instead of `ssl` or
173-
add `aio-sslv` instead of `aio-ssl` for async. Adding this will statically link OpenSSL
174-
to your crate. Do note that you'll need a C compiler, GNU Make and Perl to compile OpenSSL
175-
and statically link against it.
176-
177-
## MSRV
178-
179-
The MSRV for this crate is Rust 1.39. Need const generics? Add the `const-gen` feature to your
180-
dependency!
51+
> **Read [docs here to learn BlueQL](https://docs.skytable.io/)**
18152
18253
## Contributing
18354

0 commit comments

Comments
 (0)