Skip to content

Introduce cluster support #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: cluster-support-feature-branch
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 43 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ features = {}

[dependencies.tokio]
features = ["bytes", "default", "fs", "full", "io-std", "io-util", "libc", "macros", "mio", "net", "parking_lot", "process", "rt", "rt-multi-thread", "signal", "signal-hook-registry", "socket2", "sync", "time", "tokio-macros"]
version = "1.45.0"
version = "1.46.0"
default-features = false

[dependencies.rustyline]
Expand All @@ -30,7 +30,7 @@ features = {}

[dependencies.clap]
features = ["color", "default", "derive", "error-context", "help", "std", "suggestions", "usage", "wrap_help"]
version = "4.5.38"
version = "4.5.40"
default-features = false

[dependencies.glob]
Expand All @@ -46,8 +46,8 @@ features = {}

[dependencies.typedb-driver]
features = []
rev = "d2ce9ab4f85f8316a9087c130a20c7b1e731e8c4"
git = "https://github.com/typedb/typedb-driver"
tag = "3.4.0"
default-features = false

[dependencies.futures]
Expand Down
42 changes: 17 additions & 25 deletions RELEASE_NOTES_LATEST.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
## Distribution

Download from TypeDB Package Repository: https://cloudsmith.io/~typedb/repos/public-release/packages/?q=name:^typedb-console+version:3.4.0
Download from TypeDB Package Repository: https://cloudsmith.io/~typedb/repos/public-release/packages/?q=name:^typedb-console+version:3.4.4


## New Features
- **Introduce database export and import**
Add database export and database import operations.

Database export saves the database information (its schema and data) on the client machine as two files at provided locations:
```
# database export <name> <schema file location> <data file location>
database export my-database export/my-database.typeql export/my-database.typedb
```

Database import uses the exported files to create a new database with equivalent schema and data:
```
# database export <name> <schema file location> <data file location>
database import their-database export/my-database.typeql export/my-database.typedb
```

- **Support relative script and source commands**

We support using relative paths for the `--script` command (relative to the current directory), as well as relative paths for the REPL `source` command.

When `source` is invoked _from_ a script, the sourced file is relativised to the script, rather than the current working directory.



## Bugs Fixed
Expand All @@ -34,6 +13,19 @@ Download from TypeDB Package Repository: https://cloudsmith.io/~typedb/repos/pub


## Other Improvements
- **Update zlib dependency**
Support build on Apple Clang 17+ by updating dependencies (details: https://github.com/typedb/typedb-dependencies/pull/577).

- **Create specific exit error codes**

We generate specific error codes to check when executing commands and scripts programmatically.
We now have the following exit codes:
```
Success = 0,
GeneralError = 1,
CommandError = 2,
ConnectionError = 3,
UserInputError = 4,
QueryError = 5,
```




2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.0
3.4.4
16 changes: 9 additions & 7 deletions dependencies/typedb/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

def typedb_dependencies():
git_repository(
name = "typedb_dependencies",
remote = "https://github.com/typedb/typedb-dependencies",
commit = "fac1121c903b0c9e5924d391a883e4a0749a82a2", # sync-marker: do not remove this comment, this is used for sync-dependencies by @typedb_dependencies
)
# TODO: Return ref after merge to master, currently points to 'raft-dependencies-addition'
git_repository(
name = "typedb_dependencies",
remote = "https://github.com/typedb/typedb-dependencies",
commit = "a7f714591ac8da4e8a281ebd1542190346a56da1", # sync-marker: do not remove this comment, this is used for sync-dependencies by @typedb_dependencies
)

def typedb_driver():
# TODO: Return typedb
git_repository(
name = "typedb_driver",
remote = "https://github.com/typedb/typedb-driver",
tag = "3.4.0", # sync-marker: do not remove this comment, this is used for sync-dependencies by @typedb_driver
remote = "https://github.com/farost/typedb-driver",
commit = "d2ce9ab4f85f8316a9087c130a20c7b1e731e8c4", # sync-marker: do not remove this comment, this is used for sync-dependencies by @typedb_driver
)

def typeql():
Expand Down
37 changes: 30 additions & 7 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use clap::Parser;

pub const ADDRESS_VALUE_NAME: &str = "host:port";
pub const USERNAME_VALUE_NAME: &str = "username";

#[derive(Parser, Debug)]
#[command(author, about)]
pub struct Args {
Expand All @@ -21,13 +24,33 @@ pub struct Args {
#[arg(long, value_name = "path to script file")]
pub script: Vec<String>,

/// TypeDB address to connect to. If using TLS encryption, this must start with "https://"
#[arg(long, value_name = "host:port")]
pub address: String,
/// TypeDB address to connect to (host:port). If using TLS encryption, this must start with "https://".
#[arg(long, value_name = ADDRESS_VALUE_NAME, conflicts_with_all = ["addresses", "address_translation"])]
pub address: Option<String>,

/// A comma-separated list of TypeDB replica addresses of a single cluster to connect to.
#[arg(long, value_name = "host1:port1,host2:port2", conflicts_with_all = ["address", "address_translation"])]
pub addresses: Option<String>,

/// A comma-separated list of public=private address pairs. Public addresses are the user-facing
/// addresses of the replicas, and private addresses are the addresses used for the server-side
/// connection between replicas.
#[arg(long, value_name = "public=private,...", conflicts_with_all = ["address", "addresses"])]
pub address_translation: Option<String>,

/// If used in a cluster environment, disables attempts to redirect requests to server replicas,
/// limiting Console to communicate only with the single address specified in the `address`
/// argument.
/// Use for administrative / debug purposes to test a specific replica only: this option will
/// lower the success rate of Console's operations in production.
#[arg(long = "replication-disabled", default_value = "false")]
pub replication_disabled: bool,

// TODO: Add cluster-related retries/attempts flags from Driver Options?

/// Username for authentication
#[arg(long, value_name = "username")]
pub username: String,
#[arg(long, value_name = USERNAME_VALUE_NAME)]
pub username: Option<String>,

/// Password for authentication. Will be requested safely by default.
#[arg(long, value_name = "password")]
Expand All @@ -45,8 +68,8 @@ pub struct Args {

/// Disable error reporting. Error reporting helps TypeDB improve by reporting
/// errors and crashes to the development team.
#[arg(long = "diagnostics-disable", default_value = "false")]
pub diagnostics_disable: bool,
#[arg(long = "diagnostics-disabled", default_value = "false")]
pub diagnostics_disabled: bool,

/// Print the Console binary version
#[arg(long = "version")]
Expand Down
Loading